print.h
#include<stdio.h>
void printhello();
print.c
#include"print.h"
void printhello(){
printf("helloword");
}
main.c
#include"print.h"
main()
{
printhello();
return 0;
}
makefile:
helloword:main.o print.o
gcc -o helloword main.o print.o
main.o:main.c print.h
gcc -c main.c
print.o:print.c print.h
gcc -c print.c
clean:
rm helloword main.o print.o
注意gcc之前是tab键。