mac os: g++ failed to add framework support

你离开我真会死。 提交于 2019-12-12 00:42:47

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!