Clang(LLVM)使用框架进行编译 [英] Clang(LLVM) compile with frameworks

查看:307
本文介绍了Clang(LLVM)使用框架进行编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用:


clang -ObjC -framework UIKit -o / var / compiled / c / Documents / Source / main。 m

clang -ObjC -framework UIKit -o /var/compiled/c /Documents/Source/main.m

在OS X终端中。我也尝试了UIKit.framework,但我得到了

In OS X terminal. I also tried UIKit.framework, but I am getting


致命错误:'找不到UIKit / UIKit.h'

Fatal Error: 'UIKit/UIKit.h' not found

两者都有。

有什么建议吗?

谢谢

推荐答案

在不使用Xcode的情况下编译iOS并不容易。在您的情况下,您尝试使用iOS框架,但您既不使用iOS工具链的编译器也不使用iOS SDK。

Compiling for iOS without using Xcode is not easy. In your case, you're trying to use an iOS framework but you're using neither the iOS toolchain's compiler nor the iOS SDK.

如果查看Xcode项目的编译脚本,你会看到一些必要的标志。你需要的东西包括:

If you look at the compile transcript for an Xcode project you'll see some of the flags that are necessary. Things you'll need include:


  • xcrun -sdk iphoneos clang 选择正确的编译器和SDK

  • -arch armv7s 选择正确的CPU架构

  • -mios-version-min = 6.1 设置最低部署目标

  • xcrun -sdk iphoneos clang to choose the correct compiler and SDK
  • -arch armv7s to choose the correct CPU architecture
  • -mios-version-min=6.1 to set a minimum deployment target

一些旧的Xcode的版本还需要 -isysroot = / path / to / iPhoneOS6.1.sdk 来选择正确的SDK,因为 xcrun 没有自动完成。

Some older versions of Xcode also require -isysroot=/path/to/iPhoneOS6.1.sdk to choose the correct SDK because xcrun did not do it automatically.

这篇关于Clang(LLVM)使用框架进行编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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