c引用外部函数
我定义一个头文件head.h:
int compute(int a, int b);
定义它的实现:head.c:
#include "head.h"
int compute(int a, int b)
{
int c;
c = a + b;
return c;
}
之后,在主文件中引用head.c中的compute函数:test.c
#include "head.h"
int main ( void )
{
int a=5, b=10;
printf("compute=%d\n", compute(a, b));
}
但提示compute函数未定义,这种引用方式不对?请指教!谢谢!