我不想讨论C ++或任何编程语言!我只想知道我在使用linux ubuntu编译helloworld.cpp时出错了!
我正在学习C ++,所以我的步骤是:
在vim中打开hello.cpp并将其写入
#include <iostream.h>
int main()
{
cout << "Hello World!\n";`
return 0;
}
因此,在那之后我在终端中尝试了
g++ hello.cpp
与的输出是
hello.cpp:1:22: fatal error: iostream.h: No such file or directory
compilation terminated.
你有什么建议?任何对我有用的逐步指南?谢谢!
您应该使用#include <iostream>
,而不是iostream.h
;该.H形式是很旧,从几年弃用。
您可以在.h和非.h表格上阅读到比您想知道更多的东西:http : //members.gamedev.net/sicrane/articles/iostream.html
(此外,您应该写std::cout
一行,using namespace std;
否则一行会出现错误,这是您的下一个错误是有关编译器找不到的定义cout
。)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句