Linux 编译运行 C/C++程序

来源:互联网 发布:编程项目划分依据 编辑:程序博客网 时间:2024/04/29 15:31
终端输入命令
emacs
打开emacs编辑器。编写代码
#include <iostream>
using namespace std;

int main()
{
cout<<"hello world.."<<endl;
return 0;

}


保存为test.cpp
在终端敲击键盘ctr+Z进入终端命令行
输入命令行,进行编译(若是C语言,使用gcc代替g++)
g++ test.cpp -o testcpp
运行命令:
./testcpp
运行结果:
hello world..
可以使用emacs test.cpp进行对程序进行修改。
原创粉丝点击