The #include "plot.h" in file1.c does'nt seem to make a difference.
If I remove the line with #include plot.h it still compiles.
I have a structure as below:
├── build
├── include
└── plot.h
└── src
├── file1.c
└── plot.c
file1.c
Code:
#include <stdio.h>
#include <stdlib.h>
#include "plot.h"
int main(void) {
plotXY(3,4);
return 0;
}
plot.c
Code:
#include <stdio.h>
#include <stdlib.h>
void plotXY(int x,int y) {
printf("Res: %d\n",x*y);
}
plot.h
Code:
void plotXY(int x,int y);
I'm using the following to compile the code:
gcc src/plot.c -o build/plot.o -c
gcc src/file1.c -o build/file1.o -c -I ./include
gcc -o pgm1 build/file1.o build/plot.o