佛山网站建设和维护,森东网站建设,百度网址安全中心怎么关闭,打开qq登录网页1 Makefile
就这样理解#xff0c;帮我们对程序进行编译#xff0c;我们每次gcc g啥的很麻烦 2 举例子
我这里有3个文件first.c second.c third.c
first.c文件如下
#include stdio.h
int add(int a, int b)
{return a;
}
second.c文件如下
int sub(int a, int …1 Makefile
就这样理解帮我们对程序进行编译我们每次gcc g啥的很麻烦 2 举例子
我这里有3个文件first.c second.c third.c
first.c文件如下
#include stdio.h
int add(int a, int b)
{return a;
}
second.c文件如下
int sub(int a, int b)
{return a - b;
}
third.c文件如下
int main()
{int sum add(1, 2);printf(sum is %d\n, sum);int sub sub(5, 1);printf(sub is %d\n, sub);return 0;
}
我们编写Makefile文件一点要注意这里的名字一定是大写开头叫Makefile
all:test
first.o:first.cgcc -c first.c -o first.o
second.o:second.cgcc -c second.c -o second.o
third.o:third.cgcc -c third.c -o third.o
test:first.o second.o third.ogcc -o test first.o second.o third.o
没有写完下次在写。