问题
I have a C command line tool written in Xcode that uses the Accelerate Framework. It builds and runs as expected from Xcode. But when I try to compile it from the command line (using gcc), I get the error: "Accelerate/Accelerate.h: No such file or directory"
. I don't know if adding the location of Accelerate.h
to C_INCLUDE_PATH
is the best way to fix this. Is there a better way ?
回答1:
Try adding -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk
and then link with UIKit framework -framework UIKit
.
You can check the actual build command line in Xcode build logs (option-7 in Xcode 4). Copy the one you need and adjust as required.
Also, build it with xcodebuild
tool. It will find everything automatically like Xcode does.
来源:https://stackoverflow.com/questions/8246823/how-to-compile-a-c-program-that-uses-a-framework-without-using-xcode