构建C ++在OSX 10.9中不工作 [英] Building C++ not working in OSX 10.9

查看:151
本文介绍了构建C ++在OSX 10.9中不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:



我通过重新安装命令行工具解决了这个问题,如链接
对不起,麻烦了!



初始问题



我刚刚升级到OSX Mavericks不能使编译器工作了。
我一直在使用gcc48从macports与vim / sb2和一切都工作很好。现在我包括的任何库提供了吨的错误。我不是很有经验,我不知道该怎么办,或者什么搜索。我只想让它像以前一样工作。下面是编译基本hello world程序时所说的:

 在/ opt / local / include / gcc48 / c ++ / bits / postypes.h:40:0,
从/ opt / local / include / gcc48 / c ++ / iosfwd:40,
从/ opt / local / include / gcc48 / ios:38,
来自/ opt / local / include / gcc48 / c ++ / ostream:38,
来自/ opt / local / include / gcc48 / c ++ / iostream:39,
来自ceva .cpp:1:
/ opt / local / include / gcc48 / c ++ / cwchar:44:19:fatal错误:wchar.h:没有这样的文件或目录
#include< wchar.h>

如果您需要任何信息,请告诉我,我会提供给您。感谢您的耐心等待!

解决方案

XCode 5 / Mavericks已更改标头所在位置的预设值。



在以前的Mac OS X / XCode版本中,您会在 / usr / include 中找到标题。



在旧版本中构建gcc时,它会从该位置拾取头文件,并在您尝试构建代码时立即查找它们。



问题是文件不在那里;他们在 /Applications/Xcode.app/Contents/Developer 下的某个地方。



spec文件,以使它再次工作一致,但最好的事情是重建gcc。



如上所述,你可以安装命令行工具使用 xcode-select --install ,它将重新安装开发人员工具,包括 / usr / include p>

当我升级操作系统时,由于环境变化而遇到其他错误,我倾向于重新安装gcc。这只是我形成的习惯。这可能不是最好的习惯,但它在许多场合救了我的痛苦。


Update:

I solved the problem in the end by reinstalling command line tools, as shown in this link. Sorry for the trouble!

Initial question

I have just upgraded to OSX Mavericks and I cannot make the compiler work anymore. I've been using gcc48 from macports with vim/sb2 and everything was working just fine. Now any library that I include gives tons of errors. I am not very experienced and I do not know what to do, or what to search for. I just want it to work like before. Here is what is says when compiling a basic "hello world" program:

In file included from /opt/local/include/gcc48/c++/bits/postypes.h:40:0,
             from /opt/local/include/gcc48/c++/iosfwd:40,
             from /opt/local/include/gcc48/c++/ios:38,
             from /opt/local/include/gcc48/c++/ostream:38,
             from /opt/local/include/gcc48/c++/iostream:39,
             from ceva.cpp:1:
/opt/local/include/gcc48/c++/cwchar:44:19: fatal error: wchar.h: No such file or directory
#include <wchar.h>

If you need any information, tell me and I will provide it to you. Thank you for your patience!

解决方案

XCode 5/Mavericks have changed the defaults for where headers are located.

On prior versions of Mac OS X / XCode you would have found headers in /usr/include.

When you built gcc on the older release it picked up the headers from that location, and looks for them there now when you try to build code.

The problem is that the files are not there; they're somewhere under /Applications/Xcode.app/Contents/Developer.

You could futz about with a spec file to get it working consistently again, but the sanest thing to do is rebuild gcc.

As has been mentioned as well, you can install the command line tools using xcode-select --install, which will reinstall the developer tools, including the headers in /usr/include.

I tend to reinstall things like gcc when I upgrade my operating system as I encounter other errors due to changes in the environment. This is just a habit I've formed. It may not be the best habit, but it's saved me pain on numerous occasions.

这篇关于构建C ++在OSX 10.9中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆