求助linux下C++编程

来源:百度知道 编辑:UC知道 时间:2024/07/02 14:11:48
#include<iostream>
using namespace std;
int main()
{
cout<<"hello"<<endl;
return 0;
}

存为hello.cpp
然后在终端里 g++ (文件目录)/hello.cpp -o hello
有错的话会报错,这个没错,却没有反应,什么都不显示,gcc等编译环境已正确安装,怎么才能显示出“hello”啊?
不准备深入学习,只是现实要用到,达人们给个能成功的具体方法吧。

g++ (文件目录)/hello.cpp -o hello
这个只是编译链接

运行的话还得
./hello

去掉using namespace std;

需要执行编译出来的可执行文件。
在编译的文件目录下,执行 ./hello

./hello,执行一下!

./hello

什么叫没有反应?
是编译器没有反应还是程序没反应?