代码:
#include <Security/Security.h>
int main() {
}
编译:
$ /Developer/usr/bin/g++ test.cpp -framework Security
test.cpp:1:31: error: Security/Security.h: No such file or directory
或者:
$ /Developer/usr/bin/g++ test.cpp -F /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Security.framework/
test.cpp:1:31: error: Security/Security.h: No such file or directory
系统信息
Mac:10.6.5
Xcode:3.2.5
G ++:i686-apple-darwin10-g ++ - 4.2.1
答案 0 :(得分:1)
由于有一天过去了,没有人回答我的问题,我想与可能遇到类似问题的人分享我的解决方案。
使用Framework支持进行编译:
/Developer/usr/bin/g++ test.cpp -F/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks -L/Developer/SDKs/MacOSX10.6.sdk/usr/lib -I/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1 -I/Developer/SDKs/MacOSX10.6.sdk/usr/include
或者以更优雅的方式:
/Developer/usr/bin/g++ test.cpp -isysroot /Developer/SDKs/MacOSX10.6.sdk