环境是ubuntu10.04
编译器是GCC
一、安装GCC
【Applications】-->【Terminal】,命令输入:
sudo apt-get install build-essential
二、C语言打印hello world!
文件:test.c
编译: gcc -o test test.c
运行: ./test
三、C++语言打印hello world!
文件:test.cpp
编译: g++ -o test test.cpp
运行: ./test
四、汇编语言打印hello world!
文件:test.s
汇编: as test.s -o test.o
链接: ld test.o -o test
运行: ./test
注:编译程序时,需先进入源文件(代码)目录,如:cd src
本文详细介绍如何在Ubuntu 10.04环境下使用GCC编译器,通过C语言、C++语言及汇编语言实现HelloWorld程序。包括源代码展示、编译指令及运行方法。
1958

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



