Hei*_*h-B -1 c++ linux terminal ubuntu
这是代码....
#include <iostream>
int main()
{
cout << "WELCOME TO C++ PROGRAMMING";
return 0;
}
Run Code Online (Sandbox Code Playgroud)
当我去终端并通过命令..
g++ hello.cpp
Run Code Online (Sandbox Code Playgroud)
表明...
hello.cpp: In function ‘int main()’:
hello.cpp:4:2: error: ‘cout’ was not declared in this scope
cout << "WELCOME TO C++ PROGRAMMING";
^
hello.cpp:4:2: note: suggested alternative:
In file included from hello.cpp:1:0:
/usr/include/c++/4.8/iostream:61:18: note: ‘std::cout’
extern ostream cout; /// Linked to standard output
Run Code Online (Sandbox Code Playgroud)
那是什么原因?我该怎么办?
cout在std命名空间中找到.
#include <iostream>
int main()
{
std::cout << "Welcome";
return 0;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
497 次 |
| 最近记录: |