gpt4 book ai didi

ios - 函数指针声明编译错误

转载 作者:IT王子 更新时间:2023-10-29 08:20:28 25 4
gpt4 key购买 nike

我正在尝试将 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 '('

ras.h:100 是:

int (*rsa_mod_exp)(BIGNUM *r0,const BIGNUM *I,RSA *rsa,BN_CTX *ctx); /* Can be null */

我通过重命名 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"

我又遇到了编译错误!

最后,删除“#import”使一切正常。

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

最佳答案

问题与 Swift 无关。这是由 /usr/include/complex.h 文件中 I 的先前定义引起的(如 Brian Chen 所猜)。

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

/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

关于ios - 函数指针声明编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24298632/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com