我可以升级 Xcode 以支持更新版本的 GCC 来学习 C++0x 吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2946887/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 19:24:13  来源:igfitidea点击:

Can I upgrade Xcode to support a newer version of GCC to learn C++0x?

c++xcodemacosc++11gcc

提问by Shane

I would like to jump in learn C++0x, which has matured to a level I'm happy with.

我想开始学习 C++0x,它已经成熟到我满意的水平。

Xcode on Snow Leopard 10.6 is currently at GCC 4.2.1, and the new features I'd like to try, like std::shared_ptr, lambdas, auto, null pointer constant, unicode string literals, and other bits and pieces, require at least 4.3 (I believe).

Snow Leopard 10.6 上的 Xcode 目前处于 GCC 4.2.1,我想尝试的新功能,如 std::shared_ptr、lambdas、auto、空指针常量、unicode 字符串文字和其他零碎的东西,需要在至少 4.3(我相信)。

Ideally I'd use Xcode but I'm not even sure if you can manually upgrade the compiler for Xcode. Is this possible?

理想情况下,我会使用 Xcode,但我什至不确定您是否可以手动升级 Xcode 的编译器。这可能吗?

Otherwise, what is the best way to install a different version of GCC that doesn't interfere with the rest of the system?

否则,安装不干扰系统其余部分的不同版本的 GCC 的最佳方法是什么?

采纳答案by Shane

I ended up downloading the latest Intel Compiler for Mac trial, and it does what I need. It's a good way to test the waters without messing with your system.

我最终下载了最新的 Intel Compiler for Mac 试用版,它满足了我的需求。这是在不干扰系统的情况下测试水域的好方法。

http://software.intel.com/en-us/intel-compilers/

http://software.intel.com/en-us/intel-compilers/

回答by Justin

You may want to look at LLVM and Clang and see if those can accomplish what you're after, if you want to use XCode. Apple has been making a shift away from GCC and towards LLVM/Clang due to licensing reasons.

如果您想使用 XCode,您可能需要查看 LLVM 和 Clang,看看它们是否可以完成您所追求的任务。由于许可原因,Apple 一直在从 GCC 转向 LLVM/Clang。