Ubuntu CC++编译环境安装配置

    技术2022-05-11  53

     

    安装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:helloworld helloworld:helloworld.cpp /tg++ -g -o /$@ helloworld.cpp ' > makefile

    编译执行

    $ make all $ helloworld

    如果屏幕输出

    Hello World!!

    则安装成功

     

    最新回复(0)