此时我正在使用此收据验证进行测试,但 Xcode 抱怨这些行
require(signature_length > offsetof(struct signature_blob, certificate), outLabel);
和
require(signature_length - offsetof(struct signature_blob, certificate) >= certificate_len, outLabel);
说:"预期表达式 - 函数'offsetof'的隐式声明在C99中无效"
我该如何解决这个问题?
使用文件中的标准#import <Foundation/Foundation.h>
可以解决问题。
当然,如果你不需要任何基础类,那么就像其他人说的那样,包括stddef.h
。
offsetof
是包含在stddef.h中的宏。在源文件中添加此行。
#import <stddef.h>
该宏在"stddef.h"中定义,因此您应该有以下行:
#include <stddef.h>