Ubuntu18.04系统如何安装c 环境

发布时间:2021-07-27 15:09
 

C C语言的继承,它是一种使用非常广泛的计算机编程语言。那么在ubuntu18.04系统中如何安装c 环境呢?本文给出详细说明。

1.首先更新软件列表

sudo apt-get update

2.安装gccg

sudo apt-get install gcc

sudo apt-get install g  

3.编写测试代码

vi hello.cpp

写入以下内容

#include 

using namespace std;

int main()

{

cout << "Hello, world!" << endl;

return 0;

}

保存退出

4.编译代码

g hello.cpp -o hello

生成了名为hello的可执行文件

5.运行文件,测试安装完成

./hello

本文导读