hello world in Linux
时间:2014-09-24 14:21:16
收藏:0
阅读:210
#include <stdio.h>
int main()
{
printf("Hello world!\n");
return 0;
}
int main()
{
printf("Hello world!\n");
return 0;
}
保存文件为hello.c后,编译链接程序生成可执行文件。
方法1:gcc hello.c //生成可执行文件,默认名称为a.out
方法2:gcc hello.c -o hello //生成可执行文件hello
方法3:gcc -o hello hello.c //也可以调换一下位置
另外,linux下一半安装了若干c编译器,比如cc, c99, gcc。想知道关于编译器的信息,可以输入命令whatis cc查看。
stdio.h文件一般再linux下的/usr/include文件夹下面。
评论(0)
