linux下的第一个C程序及其编译方法

#include <stdio.h>
#include <stdlib.h>
 
int main(int argc, char ** argv)
{
    printf("hello world!\n");
 
    exit(0);
}
 
编译、链接和运行
gcc -o hello hello.c
./hello
 
另外一种编译方法
在源程序所在的目录输入:make hello
这种方式实际上使用了make的自动推导功能,最终使用的命令为:cc     hello.c   -o hello
posted @ 2016-02-19 16:13  聚沙成塔  阅读(193)  评论(0编辑  收藏  举报