升级到Xcode 10.1后,如何修复“致命错误:'iostream'文件未找到”

问题描述 投票:-1回答:1

自从更新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 ++的新手。

编辑:括号内的间距。

c++ include iostream clang++ xcode10
1个回答
1
投票

如果您仔细阅读错误消息,您会看到它显示“在命令行上传递-std=libc++”。如果你重读你实际写的东西,就会说-stdlib=libc++。删除你在那里的额外lib它应该工作得很好。

此外,正如其他人对您的帖子发表评论一样,您应该删除include指令中的空格:#include <iostream>

© www.soinside.com 2019 - 2024. All rights reserved.