[英]Xcode5: link aws4c library
我在Xcode中有C ++項目
我想在其中使用C庫aws4c https://code.google.com/p/aws4c/
這是我的apn.cpp文件:
#include "aws4c.h"
...
int main(int argc, char *argv[])
{
aws_init();
...
}
在Xcode中看起來還可以,但是當我嘗試構建時-出現錯誤
Undefined symbols for architecture x86_64:
"aws_init()", referenced from:
_main in apn.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
在Xcode5中將C庫鏈接到C ++項目的正確方法是什么?
解決了這個
添加
#ifdef __cplusplus
extern "C" {
#endif
和
#ifdef __cplusplus
}
#endif
到aws4c.h文件,它的工作原理
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.