1) Install gcc on ubuntu:
sudo apt-get install gcc g++
sudo apt-get install build-essential
2) Write a Hello.c with VIM like this:
#include <stdio.h>
int main() { printf(“Hello, gcc\n”); }
3) Compile & Link Hello.c like this:
gcc Hello.c -o Hello
4) After that you will see a file named “Hello” will be created under current working directory, input “./Hello”<Enter>. Then you will see:
Hello, gcc
The full source code could be download from here.
本文详细介绍了如何在Ubuntu系统中安装GCC编译器,包括必要的依赖包,并通过一个简单的Hello World示例演示了如何编写、编译及运行C语言程序。此外,还提供了源代码下载链接。
1251

被折叠的 条评论
为什么被折叠?



