0
点赞
收藏
分享

微信扫一扫

最简单的makefile



hello.c的内容如下:

#include <stdio.h>

int main()

{

printf("Hello World!\n");

return 0;

}


makefile 的内容如下:

hello.exe : hello.o

gcc -o hello.exe hello.o

hello.o : hello.c

gcc -c hello.c

clean :

rm hello.o hello.exe


Windows命令行(cmd.exe)下,先进入makefile 所在目录,执行 make 命令。

就会生成hello.exe了。

注意:
1, makefile 文件没有扩展名。
2, 第二、第四行、第六行前必须有一个tab

举报

相关推荐

0 条评论