帮助与文档

当前位置: 主页 > 系统相关 > 正文

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

时间:2024/4/25 8:49:31   来源:米安网络   作者:云主机配置专家   点击:16次

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

写入以下内容

#includeusing namespace std;

int main()

{

cout << "Hello, world!" << endl; return 0; }

保存退出

4.编译代码

g hello.cpp -o hello

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

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

./hello

版权保护: 本文「Ubuntu18.04系统如何安装c 环境」由 云主机配置专家 原创,转载请保留链接: https://www.miandns.com/docs/system/829.html

联系客服

0312-5535754

微信公众号