makefile的基本语法
hello : main.o message.ogcc main.o message.o -o hello
//当main.o或者message.o发生变化时,执行gcc main.o message.o -o hellomain.o : main.c //将main.c文件编译成main.o链接文件,方便管理gcc -c main.cmessage.o : message.cgcc -c message.cclean:rm -f *.o hello
补充知识
assert
#include <stdio.h>
#include <assert.h>int main() {int a = 10;assert(a == 10); // 这个断言会成功,因为a确实等于10printf("a的值是10。\n");int b = 5;assert(b == 10); // 这个断言会失败,因为b不等于10printf("b的值是10。\n");return 0;
}
a的值是10。
Assertion failed: b == 10, file D:\VS代码\solution\make项目\main.cpp, line 10