ld: symbol(s) not found for architecture armv7错误

将两个c函数从cpp文件中分离出来单独放入一个c文件中,报了下面的错:

Undefined symbols for architecture armv7:
  "MyEncrypt(unsigned char*, int, unsigned char*, int*, unsigned char*)", referenced from:
      MainScene::init() in MainScene.o
  "MyDecrypt(unsigned char*, int, unsigned char*, unsigned char*)", referenced from:
      MainScene::init() in MainScene.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)


很是抓狂啊,为什么是Undefined symbols for architecture armv7啊?明明还有arm64的。

最后的错误原因感觉跟armv7有点风马牛不相及,其实是很简单的问题,太少写C代码了,居然把这个也忘记了:

If you are using c function in c++ file. you should use extern "c"{}. In .h file

#ifdef __cplusplus
extern "C" 
{
#endif

swrve_currency_given(parameter1, parameter2, parameter3);// a c function

#ifdef __cplusplus
}
#endif


转载于:https://my.oschina.net/ioslighter/blog/360422

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值