Ubuntu C/C++编译环境安装配置

来源:互联网 发布:网络信息采集与编辑 编辑:程序博客网 时间:2024/04/23 15:16

 

安装gcc,make

sudo apt-get install gcc g++ libgcc1 libg++ make gdb


测试环境配置

编写CPP文件

$ echo '#include <stdio.h>#include <iostream>using namespace std;int main() {    printf("Hello /n");    cout<<"World!!/n";} ' > helloworld.cpp

编写makefile:

$ echo -e 'all:helloworldhelloworld:helloworld.cpp/tg++ -g -o /$@ helloworld.cpp' > makefile

编译执行

$ make all$ helloworld

如果屏幕输出

HelloWorld!!

则安装成功

 
原创粉丝点击