如何在Mac OS X Lion中安装gcc

如何在Mac OS X Lion中安装gcc

问题描述:

我是Mac OS的新手.我有一个Mac书本专业版.我正在Mac中寻找gcc.我已经安装了XCode.因此,C ++库已经随XCode一起安装.但是,我不能从XCode外部使用它.我想在Eclipse中使用c ++库.如果我已经有了XCode,我不知道如何使用eclipse进行配置或如何安装gcc?我应该使用其他图书馆吗?

I am new in mac os. I have one Mac book pro. I am looking for gcc in my Mac. I already install XCode. So, C++ library already installed with XCode. But, I can not use it from outside XCode. I want to use c++ library with Eclipse. I do not know how to configure it with eclipse or how to install gcc, if I already have XCode? Should I use any other library?

提示:

当我在终端中编写以下命令时,它会显示错误.

When I write following command in my terminal it shows an error.

$ gcc -v
-bash: gcc: command not found
$

谢谢.

您需要通过Xcode安装命令行工具.

You need to install the Command Line Tools through Xcode.

从Xcode中打开首选项",然后在下载"上单击命令行工具"旁边的安装".假设您使用的是Xcode 4.3 +.

From Xcode, open up Preferences, then on Downloads click "Install" next to the Command Line Tools. This assumes that you are using Xcode 4.3+.