【发布时间】:2015-12-13 22:22:07
【问题描述】:
早些时候,我发了一个related question。
我从我的 Mac OS 中的一个大型项目中提取了以下程序
#include <iostream>
int main(){
std::cout<<"hello"<<std::endl;
return 0;
}
使用 Clang 编译失败并出现以下错误:
$ clang test.cpp
test.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
^
1 error generated.
有关信息,
A) 我已经使用 xcodeselect --install 安装了 xcode 命令行工具。但似乎 iostream 不在 clang 的默认搜索路径中。
B) 使用 g++ 代替 clang 编译程序。但是在我的问题中,我不允许使用除 clang 之外的其他编译器,或者更改源程序。
C) 我可以看到解决方法,例如,通过调整 .bashrc 中的搜索路径或使用一些符号链接等。但我不愿意使用它们,因为我的 Clang 似乎有安装问题,并且调整路径仅有助于避免这些路径问题之一。
【问题讨论】:
-
@Baum, 101010:请花点时间阅读其他人的问题。