在OS X上设置g ++ [英] Set up g++ on OS X
问题描述
我刚刚更新到OS X Mavericks,它似乎弄乱了我的整个编译器设置。我不仅需要重新安装JDK才能使用Java编译器,当我尝试使用GCC / G ++编译C / C ++时,出现以下错误:
/usr/local/Cellar/gcc/4.7.2/gcc/lib/gcc/x86_64-apple-darwin12.2.1/4.7.2 /../../ .. /../include/c++/4.7.2/cwchar:46:19:致命错误:wchar.h:没有这样的文件或目录
不知道除了升级以外,还有什么想法弄糟了。我的问题是:我如何设置g ++在OS X上编译?如果已经设置好了,这里有什么问题?
如果我可以提供更多信息,请告诉我。
注意:我已经使用自制软件安装了gcc 4.7,但它似乎不起作用。当我特别使用 g ++ - 4.7 code.cpp
时,我得到了同样的错误。
经常提到 xcode-select --install
命令一直说它找不到所需的软件。
澄清:您需要使用Homebrew安装gcc-4.7。 CMD工具的最新版本的更新只修正了从Mountain Lion升级到Mavericks导致的兼容性问题。
I just updated to OS X Mavericks and it seems it messed up my whole compiler setup. Not only do I have to reinstall a JDK in order to use a Java compiler, I get the following error when I'm trying to compile C/C++ using GCC/G++:
/usr/local/Cellar/gcc/4.7.2/gcc/lib/gcc/x86_64-apple-darwin12.2.1/4.7.2/../../../../include/c++/4.7.2/cwchar:46:19: fatal error: wchar.h: No such file or directory
Not sure what to think other than upgrading messed it up. My question is: how do I set up g++ to compile on OS X? If it's already set up, what is the problem here?
If I can provide more information, please let me know.
Note: I've installed gcc 4.7 using homebrew, but it doesn't seem to work. When I use g++-4.7 code.cpp
specifically, I get the same error.
Installing the Command Line Tools (OS X Mavericks) for Xcode - Late October 2013 solved it for me. Here is the link:
The often mentioned xcode-select --install
command kept saying it cannot find the requested software.
To clarify: You need to already have gcc-4.7 installed using Homebrew. The update to the latest version of CMD Tools only fixes compatibility issues caused by upgrading from Mountain Lion to Mavericks.
这篇关于在OS X上设置g ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!