如何修复“严重错误:找不到'iostream'文件”升级到Xcode 10.1后 [英] How to fix "fatal error: 'iostream' file not found" after upgrading to Xcode 10.1

查看:87
本文介绍了如何修复“严重错误:找不到'iostream'文件”升级到Xcode 10.1后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此错误仅在更新Xcode(和MacOS Mojave 10.14)之后才出现。 #include< Python> 发生了类似的事情,我改用#include python2.7 / Python.h进行了修复。

This error has only appeared for me since updating Xcode (and to MacOS Mojave 10.14). Something similar happened with #include <Python>, which I fixed by instead using #include "python2.7/Python.h".

中讨论了类似的错误Clang看不到基本标头。当我尝试

clang ++ -stdlib = libc ++ PyTrans.cpp -o -v

我得到

ld:对于体系结构x86_64
lang找不到符号:错误:链接器命令失败,退出代码为1(使用-v查看调用)

完整错误:

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:致命错误:找不到 iostream文件
include< iostream>
^ ~~~~~~~~~
1条警告和1条错误。
错误:命令 gcc失败,退出状态为1

任何帮助将不胜感激;我对C ++很陌生。

Any help would be greatly appreciated; I am very new to C++.

编辑:括号内的空格。

推荐答案

如果仔细阅读错误消息,您会看到它说在命令行中传递 -std = libc ++ 。如果您重新阅读实际写的内容,则会显示 -stdlib = libc ++ 。删除其中多余的 lib ,它应该可以正常工作。

If you read the error message carefully, you'll see that it says "pass -std=libc++ on the command line." If you re-read what you actually wrote, it says -stdlib=libc++. Remove the extra lib you have in there and it should work just fine.

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

Also, as others have commented on your post, you should remove the spaces in your include directives: #include <iostream>

这篇关于如何修复“严重错误:找不到'iostream'文件”升级到Xcode 10.1后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆