MacBook 上的 C 和 C++ 编程

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6100257/
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-08-28 19:29:40  来源:igfitidea点击:

C and C++ programming on MacBook

c++cmacos

提问by Shenoy Tinny

I recently bought a macbook and was wondering if I can write C and C++ programs on mac without having to install anything more. Say for Java, mac came with a preinstalled version.

我最近买了一台 macbook,想知道是否可以在 mac 上编写 C 和 C++ 程序而无需安装任何其他东西。以 Java 为例,mac 附带了一个预装版本。

Is it the same for C/C++. if yes, can you pls let me know hoe to compile and run a sample program or if not, can you please let me know what stuff to download?

对于 C/C++ 是否相同。如果是的话,你能告诉我 hoe 来编译和运行一个示例程序,或者如果没有,你能告诉我要下载什么东西吗?

回答by maerics

You need to install the Mac Developer Tools either from your original Mac OS X disk or by downloading the latest version. This package includes the GCC compiler collection (supporting the C and C++ languages, amongst others).

您需要从原始 Mac OS X 磁盘或通过下载最新版本来安装 Mac 开发人员工具。该软件包包括 GCC 编译器集合(支持 C 和 C++ 语言等)。

回答by sidyll

You need to install the developer tools, which are on your MacBook DVD. Check for custom installations.

您需要安装 MacBook DVD 上的开发人员工具。检查自定义安装。

回答by sergio

You should install Apple Developers Tools.

您应该安装Apple Developers Tools

Basically you should get a (free) developer accountand then download Xcode.

基本上你应该获得一个(免费的)开发者帐户,然后下载 Xcode。

Unfortunately, starting with Xcode 4, Apple is charging 5$ for the download. So you could either decide to pay this, or download the previous version (Xcode 3)

不幸的是,从 Xcode 4 开始,Apple 的下载费用为 5 美元。所以你可以决定支付这个费用,或者下载以前的版本(Xcode 3)

The main page for Xcode is this. There you will find links to Xcode 4 and Xcode 3 (search within the page)

Xcode 的主页是这个。在那里你会找到 Xcode 4 和 Xcode 3 的链接(在页面内搜索)