Broken c++ std libraries on macOS High Sierra 10.13(macOS High Sierra 10.13 上损坏的 c++ std 库)
问题描述
我最近买了一台新的 MacBook,我在上面转移了我的旧会话.从那时起,在我升级到 10.13 之后,我无法让 clang 编译任何内容,包括仅 iostream.
鉴于这个程序:
I recently bought a new MacBook on which I transferred my old session. Since then, and after i upgraded to 10.13, i can't get clang to compile anything including only iostream.
Given this program :
在 g++ main.cpp
时给我这个输出:
gives my this output when g++ main.cpp
:
我尝试了以下方法:
- 使用
Xcode-select --reset
重置 CLT - 重新安装 CLT
- 重新安装Xcode
这些解决方案都没有奏效,这开始让我发疯.有人有同样的问题并找到了解决方案吗?
None of these solution worked and this starting to drive me crazy. Does somebody has the same problem and found a solution ?
Xcode C++ 项目已成功编译,但仍然不明白为什么它不会在终端中.
EDIT : Xcode C++ Projects are successfully compiling, still don't understand why it would not in a terminal.
推荐答案
我在转移到 macOS High Sierra 后遇到了完全相同的问题(虽然,错误不一样,但相似).
I had exactly the same problem after transferring to macOS High Sierra (though, errors were not the same, but similar).
我通过将 /usr/local/include
重命名为 /usr/local/include_old
找到了一种解决方法(好吧,名称并不重要,只是事实上 g++/clang
将不再在此文件夹中搜索标题).
I found a workaround by renaming /usr/local/include
to /usr/local/include_old
(well, name does not really matter, just the fact that g++/clang
will not search for headers in this folder anymore).
这篇关于macOS High Sierra 10.13 上损坏的 c++ std 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!