string.h:没有这样的文件或目录
fatal error: string.h: No such file or directory
在我的环境中,我不能包含<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>
那么我就不能运行我的代码了。这是c++的问题。
我检查了这篇文章,但是这个程序不工作。我已经安装了xcode-select(命令行工具),我卸载了xcode-select并重新安装了xcode-select,但它不工作。
c++不能在OSX 10.9中运行
重新安装标头修复了我的问题:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
相关文章:
- 'string'文件在带有C++文件的iOS插件上找不到
- C++将文件行分离为String和Int
- pip install uwsgi 失败,出现 /usr/local/include/string/string.h:7:10:致命错误:找不到'sstream'文件?
- 如何将地图<列表<string>、矢量<string>>输出到输出文件?
- 无法将文件的内容读入 std::string
- 如何使用 rapidjson 读取 json 文件并输出到 std::string?
- Qt UTF-8 文件到 std::string 添加额外的字符
- 将C 数组写成文件,避免创建std :: String
- 我是否也应该包括 string.h,即使它存在于头文件中
- 如何使用矢量数据使用 rapidjson 库创建 json 文件<string>?
- 使用 std::find 查找从二进制文件中读取的字符并转换为 std::vector 中的 std::string<string> 会产生这种不可预测的行为?
- YAML::LoadFile(std::string const&) 找不到文件 [ROS 中的 yaml-cpp]
- 通过读取文件创建映射<字符串,矢量>时如何管理内存<string>
- 将文件的二进制内容推送到 std::string 以用于 Google 的 Snappy
- 如何在C 中的文件中直接读取std :: String中的字符串
- 比较输入的C弦与文件读取c-string
- 使用 string::find 来解析文件
- 使用 std::write 和 std::read C++ 读取包含 std::string 到.dat文件的结构
- 如何为使用矢量的函数编写 SWIG 接口文件<string>?
- 包括标准头文件.string.h还是cstring?或两者兼有