#define MAXSIZE 128
int test_func1 (int);
int test_func2 (int, int);
#include "head.h"
int test_func1 (int num)
{
int fun1;
fun1 = num + MAXSIZE;
return fun1;
}
#include "head.h"
int test_func2(int a, int b)
{
int new;
new = a + b + MAXSIZE;
return new;
}
hello.exe:fun1.o fun2.o hello.o
gcc fun1.o fun2.o hello.o -o hello.exe
hello.o:hello.c fun1.o fun2.o
gcc -Wall -g -c hello.c -o hello.o
fun1.o: fun1.c head.h
gcc -Wall -g -c fun1.c -o fun1.o
fun2.o: fun2.c head.h
gcc -Wall -g -c fun2.c -o fun2.o
beyes@linux-beyes:~/C/Make> make
gcc -Wall -g -c fun1.c -o fun1.o
gcc -Wall -g -c fun2.c -o fun2.o
gcc -Wall -g -c hello.c -o hello.o
gcc fun1.o fun2.o hello.o -o hello.exe
hello.c:10: warning: implicit declaration of function ‘test_func1’
hello.c:12: warning: implicit declaration of function ‘test_func2’
#include <stdio.h>
void printhello11 ()
{
printf("hello_11\\n");
}
#include <stdio.h>
void printhello12 ()
{
printf("hello_12\\n");
}
#include <stdio.h>
void printhello21 ()
{
printf("hello_21\\n");
}
#include <stdio.h>
void printhello22 ()
{
printf("hello_22\\n");
}
#include <stdio.h>
int main (void)
{
printhllo11();
printhllo12();
printhllo21();
printhllo22();
return (0);
}
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |