作者:前年老妖 | 来源:互联网 | 2017-08-02 23:21
我用的是ubuntu,可以直接安装编译器。具体命令如下:(注:最好用root身份来安装)
1、使用如下命令进行安装(执行命令过程中会自动到网上下载文件,并安装)
apt-get install gcc
apt-get install make
apt-get install autoconf
apt-get install automake
apt-get install libtool
apt-get install gdb
apt-get install g++
2、编写hello.cpp
#include
int main()
{
std::cout<<"hello World!.\n";
return 1;
}
3、编译文件
g++ hello.cpp -o hello.out
4、执行生成的文件
hello.out