How to compile a C program that uses a Framework without using Xcode

烂漫一生 提交于 2020-01-05 08:09:17

问题


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

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