这是我的测试.cpp
#include<iostream>
using namespace std;
int main()
{
cout<<"hello world";
return 0;
}
$ /opt/ELDK42/usr/bin/ppc-linux-g++ test.cpp
编译错误:
test.cpp:1:19: error: iostream: No such file or directory
test.cpp: In function 'int main()':
test.cpp:10: error: 'cout' was not declared in this scope
为什么它无法从任何包含目录中获取 iostream?因此,我尝试通过显式包含来进行编译
/opt/ELDK42/usr/bin/ppc_85xx-g++ test.cpp -I/opt/ELDK42/ppc_85xx/usr/include/c++/4.2.2/
然后,出现了以下错误:
In file included from test.cpp:1:
/opt/ELDK42/ppc_85xx/usr/include/c++/4.2.2/iostream:44:28: error: bits/c++config.h: No such file or directory
In file included from /opt/ELDK42/ppc_85xx/usr/include/c++/4.2.2/ios:43,
from /opt/ELDK42/ppc_85xx/usr/include/c++/4.2.2/ostream:45,
from /opt/ELDK42/ppc_85xx/usr/include/c++/4.2./iostream:45,
但是,我在这里看到缺少的头文件:
/opt/ELDK42/ppc_85xx/usr/include/c++/4.2.2/powerpc-linux/bits/c++config.h
我无法弄清楚为什么 gcc 不能正确找到头文件并进行编译?
这和 ELDK 版本有关系吗?
任何帮助,都非常感谢。
系统详细信息: Ubuntu 14.04 gcc 4.2.2