xcode 致命错误:string.h:没有那个文件或目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39736728/
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
fatal error: string.h: No such file or directory
提问by hiroyuki tanaka
In my environment, I couldn't include <cstring>
.
My g++ version is 4.9.3 (Homebrew gcc49 4.9.3).
在我的环境中,我无法包含<cstring>
. 我的 g++ 版本是 4.9.3 (Homebrew gcc49 4.9.3)。
The error is:
错误是:
- /usr/local/Cellar/gcc49/4.9.3/include/c++/4.9.3/cstring:42:20: fatal
error: string.h: No such file or directory
"#include string.h"
But, in another environment (g++ 4.8.4[Ubuntu 4.8.4-2ubuntu1~14.04.3]), I can include <cstring>
and run.
但是,在另一个环境(g++ 4.8.4[Ubuntu 4.8.4-2ubuntu1~14.04.3])中,我可以包含<cstring>
并运行。
What's the problem and how do I solve it?
有什么问题,我该如何解决?
[P.S.] Maybe, I misunderstood about the problem. I tried to run my previous code, but got an error like this:
[PS] 也许,我误解了这个问题。我试图运行我以前的代码,但得到了这样的错误:
/usr/local/Cellar/gcc49/4.9.3/include/c++/4.9.3/cassert:43:20: fatal error: assert.h: No such file or directory
#include <assert.h>
Then, I can't run my code. It is a g++'s problem.
然后,我无法运行我的代码。这是 g++ 的问题。
I checked this article, but this procedure is not working. I already installed xcode-select (commmad line tool) and I uninstalled xcode-select and reinstalled xcode-select, but it's not working.
我检查了这篇文章,但这个程序不起作用。我已经安装了 xcode-select(命令行工具)并且我卸载了 xcode-select 并重新安装了 xcode-select,但它不起作用。
回答by Tim Givois
Reinstalling the heaaders fixed my issue:
重新安装标题修复了我的问题:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg