0

代码:

#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

4

1 回答 1

1

由于一天过去了,没有人回答我的问题,我想与可能遇到类似问题的人分享我的解决方案。

要使用框架支持进行编译:

/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
于 2013-07-29T02:41:25.163 回答