本文介绍了在OS X上设置g ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我刚刚更新到OS X Mavericks,它似乎弄乱了我的整个编译器设置。我不仅需要重新安装JDK才能使用Java编译器,当我尝试使用GCC / G ++编译C / C ++时,出现以下错误:

 安装Xcode的命令行工具(OS X Mavericks) -  2013年10月下旬为我解决了这个问题。这里是链接:





经常提到 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:

OSX: Xcode Downloads

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 ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 22:21