码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2014-12-25 16:37:33      阅读:1133      评论:0      收藏:0      [点我收藏+]

标签:

将两个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 __cplusplusextern "C" 
{
#endif

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

#ifdef __cplusplus
}
#endif


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

标签:

原文地址:http://my.oschina.net/u/1443646/blog/360422

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!