Why does it throws an error while putting functions into header in VSCode but not GCC?

65 views Asked by At

I'm programming a game in C using VS Code as my IDE and wanted to put my functions into a header file. So now I have ship-cap-crew.c, gamefunct.c and gamefunct.h. When I try to use #include "gamefunct.h", I get an error: (.text+0xac): undefined reference to 'playercount', and the same from all of the other functions called from main.

This goes away when I use #include "gamefunct.c" or if I use GCC to run the code rather than from VS Code. I just want to be able to run the code straight from Visual Studio.

0

There are 0 answers