< 返回新闻公告列表

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

发布时间:2023-4-6 17:11:34    来源: 纵横云

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

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

1.首先更新软件列表

sudo apt-get update

2.安装gcc和g

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的可执行文件

1418.png

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

./hello

19906048601
19906048601 19906048601
返回顶部
返回顶部 返回顶部