首页 > 代码库 > ld: symbol(s) not found for architecture armv7错误
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 __cplusplusextern "C" { #endif swrve_currency_given(parameter1, parameter2, parameter3);// a c function #ifdef __cplusplus } #endif
ld: symbol(s) not found for architecture armv7错误
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。