c++ - 升级到 Xcode 10.1 后如何修复“致命错误:找不到‘iostream’文件”
问题描述
自从更新 Xcode(以及 MacOS Mojave 10.14)后,我才出现此错误。发生了类似的事情#include <Python>
,我改用#include“python2.7/Python.h”来修复它。
在Clang doesn't see basic headers 中讨论了一个类似的错误。当我尝试
clang++ -stdlib=libc++ PyTrans.cpp -o -v
我明白了
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
.
完整的错误:
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
/Users/joe/Documents/Research/EkpPyTransportDist/PyTransport/PyTrans/PyTrans.cpp:20:10: fatal error: 'iostream' file not found
include <iostream>
^~~~~~~~~~
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1
任何帮助将不胜感激; 我对 C++ 很陌生。
编辑:括号内的间距。
解决方案
如果您仔细阅读错误消息,您会看到它显示“-std=libc++
在命令行上传递”。如果您重新阅读您实际写的内容,它会显示-stdlib=libc++
. 删除lib
你在那里的多余部分,它应该可以正常工作。
此外,正如其他人对您的帖子发表的评论一样,您应该删除包含指令中的空格:#include <iostream>
推荐阅读
- c# - 在同一目录中找不到文件
- java - 如何在 Toolbar 和 TabLayout 之间插入图像?
- c# - 无法翻译 LINQ 表达式。以可以翻译的形式重写查询
- python - 找不到满足要求 tensorflow==1.2.0 的版本
- android - 多个视图模型的基类
- blazor - Blazor 调用 window.addEventListener
- c++ - wofstream 不在文件中写入日文字符
- jquery - 如何在没有远程模块的情况下最大化和最小化电子窗口
- regex - IMG 文件名的正则表达式
- c++ - 未定义对 asio::ip::basic_endpoint 的引用