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
2021年目标:完成新书《闻缺陷则喜》,本博客右上公告有下载、阅读链接。