Linux上编写C/C++

编译C: gcc test.c -o test

运行C: ./test

编译C++:g++ test.cpp -o test

运行C++:./test

安装gcc和g++

gcc用来编译C代码,g++用来编译C++代码

Ubuntu 安装gcc和g++

sudo apt install gcc

sudo apt install g++

安装报错,更新一下再安装 sudo apt-get update 和 sudo apt-get upgrade

编写C/C++代码

使用vim

创建文件 touch test.c

编写代码 vim test.c

编译运行

编译C: gcc test.c -o test

运行C: ./test

编译C++:g++ test.cpp -o test

运行C++:./test

posted @ 2022-07-25 12:00  zkx98  阅读(56)  评论(0编辑  收藏  举报