是否有适用于 MacOSX 的免费 C++ 编译器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6438792/
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
Are there any free C++ compilers for MacOSX?
提问by user751747
Is there any free C++ compilers to install in Mac OS (apple machine)
是否有任何免费的 C++ 编译器可以安装在 Mac OS(苹果机)中
please ..tell me the links to download & procedure to INSTALL.Since iam an new use for mac OS
请..告诉我下载和安装程序的链接。因为我是 mac OS 的新用途
回答by Bo Persson
The native compilers are gcc and llvm which are part of the XCode environment.
本机编译器是 gcc 和 llvm,它们是 XCode 环境的一部分。
While the compilers are free, the latest IDE is not but can be bought from the app store for something like $5.99$4.99.
虽然编译器是免费的,但最新的 IDE 不是,但可以从应用商店以5.99美元 4.99美元的价格购买。
If you don't need the latest version, a 3.x version of XCode, including gcc, should be on your OSX DVD. Just install it from there.
如果您不需要最新版本,那么您的 OSX DVD 上应该有一个 3.x 版本的 XCode,包括 gcc。只需从那里安装它。
回答by DumbCoder
回答by juanchopanza
I am hapily using gcc.4.6.1 prerelease from MacPorts. You'll need to install macportsfirst. Then,
我很高兴使用MacPorts 的gcc.4.6.1 预发行版。您需要先安装 macports。然后,
sudo port install gcc46
须藤端口安装gcc46
This will most likely install is in opt/local/bin
, and the executable will be /opt/local/bin/gcc-mp-4.6
and `/opt/local/bin/g++-mp-4.6. One advantage is that it doesn't overwrite your system gcc. To use it as default (for C++) , I have set an alias in my login script:
这很可能安装在 中opt/local/bin
,可执行文件将是/opt/local/bin/gcc-mp-4.6
和`/opt/local/bin/g++-mp-4.6。一个优点是它不会覆盖您的系统 gcc。要将其用作默认值(对于 C++),我在登录脚本中设置了一个别名:
alias g++='g++-mp-4.6 -std=c++0x'
The last option is to have access to gcc 4.6 implementation of c++0x, although beware that it may be incomplete or may change in the future when c++ 2011 comes out.
最后一个选项是可以访问 c++0x 的 gcc 4.6 实现,但要注意它可能不完整,或者在 c++ 2011 出来时可能会在未来发生变化。
回答by Jesper
Xcode, including compilers, is on your Mac OS X installation DVD. You can install it from the DVD, or else download it for free from Apple's developer websiteor for a small fee (where I live it is about 5) from the OS X app store.
Xcode(包括编译器)位于 Mac OS X 安装 DVD 上。您可以从 DVD 安装它,也可以从 Apple 的开发者网站免费下载或从 OS X 应用程序商店支付少量费用(我住的地方大约 5美元)下载它。
回答by dmeister
Apple provides a fully integrated IDE - Xcode- for a very low price (nearly free) with its operating system (or as download). Until recently it was free.
Apple以非常低的价格(几乎免费)及其操作系统(或作为下载)提供了一个完全集成的 IDE - Xcode。直到最近它还是免费的。
clang, gccand some other compilers are available for Mac OSX. Its foundations in the UNIX world makes it quite easy to find a lot of OSS compilers.
clang、gcc和其他一些编译器可用于 Mac OSX。它在 UNIX 世界中的基础使得很容易找到很多 OSS 编译器。