[问题][问题一解决]请问在Ubuntu下如何把.c 源文件编译成可执行文件??
发表于 : 2006-09-10 20:47
是不是这样的阿 ??
#chmod +x 文件名.c
#chmod +x 文件名.c
1。新建一个C文件sudo apt-get install gcc
sudo apt-get install libc6-dev
2。编程vi hello.c
3。点“ESC”键,然后一次输入“:wq”,即可保存退出!!#include <stdio.h>
main()
{
printf("Hello Linux!!\n");
}
5。赋予hello文件可执行权限gcc -o hello hello.c
6。运行hello文件chmod +x hello
7。结果显示./hello
root@cat101computer:/home/oem# ./hello
Hello Linux!!
第五步可以省略xiaomao101 写了:谢谢,我已经在Linux下编出了我的第一个C了!!
俺是菜鸟,俺很菜!!
步骤如下:
0。安装gcc和libc6-dev包1。新建一个C文件sudo apt-get install gcc
sudo apt-get install libc6-dev2。编程vi hello.c3。点“ESC”键,然后一次输入“:wq”,即可保存退出!!#include <stdio.h>
main()
{
printf("Hello Linux!!\n");
}
4。编译源程序,生成hello文件5。赋予hello文件可执行权限gcc -o hello hello.c6。运行hello文件chmod +x hello7。结果显示./helloroot@cat101computer:/home/oem# ./hello
Hello Linux!!