Tit*_*tus 1 xcode objective-c static-libraries ios
我有一个静态库X,它在C中.我有另一个静态库Y,它在目标C中,其.mm文件引用了库X的功能.现在在单个视图应用程序中我使用了库Y.但是在编译期间它发表错误说
Undefined symbols for architecture i386:
"encode()", referenced from:
_playMediaInternal in libXMedia.a(XMediaInternal.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
上面的编码函数存在于库X中,库Y正在使用它,单视图应用程序使用它.有什么建议 ?我在同一条线上看过其他查询,但没有运气.另一个线程链接
从Apple开发者网站我一直在尝试使用静态库链接.
我已将手机连接到Laptoop并已开始编译.它仍然给我错误.现在我觉得它与链接本身而不是架构有关
我正在粘贴确切的东西.对我来说,问题在于具有基于C的函数调用的标题
如果你在c ++文件中使用c函数.你应该使用extern "c"{}.在.h文件中
#ifdef __cplusplus
extern "C" {
#endif
swrve_currency_given(parameter1, parameter2, parameter3);// a c function
#ifdef __cplusplus
}
#endif
Run Code Online (Sandbox Code Playgroud)
extern"C"意味着被C++编译器识别,并通知编译器所提到的函数是(或将)以C风格编译的.
如果您要链接到编译为C代码的库.使用
extern "C" {
#include "c_only_header.h"
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3610 次 |
| 最近记录: |