3

I'm trying to build a project which is originally written for archlinux. The building process works fine on that archlinux but has a huge amount of errors when I tried to build it on my mac. The project is basically written in C++11 so it's very unstable. I think there has something to do with the compiler because the clang version in mac is 4.2(It actually shows 'Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)' when I type clang --version) and 3.3 for linux. So I want a different version of clang, perhaps 3.3. How Can I specify the version of my compiler when trying to build the project?

4

2 回答 2

2

有些人可能会争辩说这属于apple.stackexchange.com,但我不确定 C++11 标签在那里会引起很多关注:)

Xcode 5.0 现在可从 App Store 获得。安装它,转到首选项-> 下载,然后安装命令行工具。然而...

首先,您需要转到 Preferences -> Accounts 并添加您的 Apple ID。出于某种原因,命令行工具下载需要帐户登录。我不知道这样做的理由是什么。

> clang -v
Apple LLVM version 5.0 (clang-500.2.75) (based on LLVM 3.3svn)
于 2013-09-21T13:10:21.553 回答
1

如果您愿意从命令行构建,make例如使用(这听起来很可能是因为该项目来自 Linux),然后安装Macports并安装您想要的任何版本的 clang

$sudo port install clang-3.1
$sudo clang_select

请注意,如果您要使用而不是普通 oldclang调用 Xcode 版本,则此版本不应干扰 Xcode 命令行包。xcrun clangclang

于 2013-09-21T09:08:02.783 回答