ubuntu配置c语言环境
在Ubuntu上配置C语言环境,你需要安装GCC编译器,以下是步骤和示例代码:
-
打开终端。
-
更新包列表:
sudo apt update
-
安装GCC编译器:
sudo apt install gcc
-
验证安装是否成功:
gcc --version
-
创建一个简单的C语言源文件,例如
hello.c
:#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
-
编译C源文件:
gcc -o hello hello.c
-
运行编译后的程序:
./hello