I want to call a function that reside in my func.c file into my main.c This is my func.c
#include "func.h"
int func(int i) {
return ++i ;
}
This is my header file func.h
int func(int i);
And this is my main code: main.c
#include <stdio.h>
#include <stdlib.h>
#include "func.h"
main()
{
int res = func(3);
printf("%d\n",res);
system("pause");
}
Compiling the main code I get the error: undefined reference to 'func' My goal is to call function from an external file (that is not part of the same compilation unit). How to do it? Thank you!