问题
Code:
#include <Security/Security.h>
int main() {
}
Compile:
$ /Developer/usr/bin/g++ test.cpp -framework Security
test.cpp:1:31: error: Security/Security.h: No such file or directory
Or:
$ /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
System Info
Mac: 10.6.5
Xcode: 3.2.5
G++: i686-apple-darwin10-g++-4.2.1
回答1:
Since one day has passed and no one answered my question, I'd like to share my solution with those who might run into similar problems.
To compile with Framework support:
/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
Or in a more elegant way:
/Developer/usr/bin/g++ test.cpp -isysroot /Developer/SDKs/MacOSX10.6.sdk
来源:https://stackoverflow.com/questions/17894501/mac-os-g-failed-to-add-framework-support