如何在不使用Xcode的情况下编译使用Framework的C程序 [英] How to compile a C program that uses a Framework without using Xcode

查看:85
本文介绍了如何在不使用Xcode的情况下编译使用Framework的C程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Xcode编写的C命令行工具,该工具使用Accelerate Framework.它可以按预期从Xcode生成和运行.但是,当我尝试从命令行(使用gcc)进行编译时,出现错误:"Accelerate/Accelerate.h: No such file or directory".我不知道将Accelerate.h的位置添加到C_INCLUDE_PATH是否是解决此问题的最佳方法.有更好的方法吗?

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 ?

推荐答案

尝试添加-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk,然后与UIKit框架-framework UIKit链接.

Try adding -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk and then link with UIKit framework -framework UIKit.

您可以在Xcode构建日志中检查实际的构建命令行(Xcode 4中的选项7).复制所需的副本,然后根据需要进行调整.

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.

此外,使用xcodebuild工具进行构建.它将像Xcode一样自动找到所有内容.

Also, build it with xcodebuild tool. It will find everything automatically like Xcode does.

这篇关于如何在不使用Xcode的情况下编译使用Framework的C程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆