不用IDE工具,只用终端,测试->编译->运行,一气呵成!

 

具体步骤:

1、确保已经安装gcc,安装方法:sudo apt-get install gcc

 

2、编写一个简单的cpp文件test.cpp,放在指定地方

 

示例:

 

 

# include 
using namespace std;

int larger(int, int);
int main(){
int i, j;
cout<<"请输入两个数:"< cin>>i>>j;
cout<<"较大的数是:"< }

int larger(int a,int b){
return a>=b?a:b;
}

 

将此程序保存在/home/user/桌面, 打开终端(注意user即你的系统用户名)

 

3、编译: g++ /home/user/桌面/test.cpp -o test.out

 

4、如果没有提示错误,可以运行编译后的程序:./test.out

 

说明:test.out可以替换为任意的名字。

 

(责任编辑:A6)

本站文章仅代表作者观点,本站仅传递信息,并不表示赞同或反对.转载本站点内容时请注明来自www.linuxeden.com-Linux伊甸园。如不注明,www.linuxeden.com将根据《互联网著作权行政保护办法》追究其相应法律责任。