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

[复制链接] |主动推送
查看157 | 回复0 | 2024-9-12 00:46:22 | 显示全部楼层 |阅读模式
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的可执行文件
000309dm6md4d37y7hm4mo.jpg
5.运行文件,测试安装完成
./hello
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则