在我的环境中,我无法包含 <cstring>
.
我的 g++ 版本是 4.9.3 (Homebrew gcc49 4.9.3)。
错误是:
- /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"
但是,在另一个环境中(g++ 4.8.4[Ubuntu 4.8.4-2ubuntu1~14.04.3]),我可以包括<cstring>
并运行。
问题是什么,我该如何解决?
[附言] 也许,我误解了这个问题。 我尝试运行我之前的代码,但出现了这样的错误:
/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>
然后,我无法运行我的代码。 这是一个g++的问题。
我检查了这篇文章,但这个程序不起作用。 我已经安装了 xcode-select(命令行工具),我卸载了 xcode-select 并重新安装了 xcode-select,但它不起作用。
最佳答案
重新安装 header 解决了我的问题:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
关于c++ - fatal error : string. h:没有那个文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39736728/