Hello, GCC on Ubuntu
- Install gcc on ubuntu:
$ sudo apt-get install gcc g++
$ sudo apt-get install build-essential
1
2
2
- Write a text file named Hello.c with VIM like this:
#include <stdio.h>
int main() { printf(“Hello, gcc\n”); }
1
2
3
2
3
- Compile & Link Hello.c:
$ gcc Hello.c -o Hello
1
- After that you will see a file named Hello will be created under current working directory, run it:
$ ./Hello
$ Hello, gcc
1
2
2

评论
发表评论