参考《linux下的C语言开发(开篇)》系列linux
http://blog.csdn.net/feixiaoxing/article/details/7194756vim
http://dsec.pku.edu.cn/~weibo/ebook/linux_c_2.pdfide
vim /opt/2.c #include <stdio.h> int main() { printf("hello!\n"); return 1; }
编译ui
[root@localhost opt]# gcc -o 2 2.c.net
对生成的程序设置执行权限blog
[root@localhost opt]# chmod +x 2ci
执行成功开发
# ./2it
hello!io
如今说说一个错误的
vim /opt/1.c int main(int argc,char **argv) { printf("Hello Linux\n"); }
gcc -o 1 1.c
可是提示
1.c: In function ‘main’: 1.c:3: warning: incompatible implicit declaration of built-in function ‘printf’
后来在顶部加上了
#include <stdio.h>
编译时候没有warning了。
成功执行
./1 Hello Linux