使用函数指针声明编译错误

ywe*_*wen 16 openssl compiler-errors ios

我正在尝试将openssl导入到我的swift项目中,但是当我添加#import "ras.h"xxx-Bridging-Header.h,我得到了下面的编译错误.

<unknown>:0: error: /Users/wenyun/workspace/newsvn/newios/ios/VanJoyPay2/VanJoyPay2/opensource/OpenSSLRSAWrapper/openssl/include/openssl/rsa.h:100: expected ')'
<unknown>:0: note: /Users/wenyun/workspace/newsvn/newios/ios/VanJoyPay2/VanJoyPay2/opensource/OpenSSLRSAWrapper/o penssl/include/openssl/rsa.h:100: to match this '('
Run Code Online (Sandbox Code Playgroud)

ras.h:100是:

int (*rsa_mod_exp)(BIGNUM *r0,const BIGNUM *I,RSA *rsa,BN_CTX *ctx); /* Can be null */
Run Code Online (Sandbox Code Playgroud)

我通过重命名const BIGNUM *I来修复错误const BIGNUM *i.有谁知道角色为何I如此特别?

我今天做了另一个测试,结果看起来很奇怪.我创建了一个新的swift项目,编写了3个头文件:

test.h
int test(char *I);

test2.h
#import "test3.h"
#import <Foundation/Foundation.h>

test3.h
int test3();


xxx-Bridging-Header.h
#import "test2.h"
#import "test.h"
Run Code Online (Sandbox Code Playgroud)

我又得到了编译错误!

最后,删除"#import"使一切正常.

Why the character "I" could not work together with #import <xxx>?

Lau*_*ble 9

问题与Swift无关.它是由先前的定义造成I了在/usr/include/complex.h文件(如布赖恩·陈猜对了).

以下是编译器报告的违规行:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/usr/include/complex.h:42:11: note: expanded from macro 'I'
#define I _Complex_I
Run Code Online (Sandbox Code Playgroud)