I have a piece of a project in which I have some code files defining functions, some header files, and then a .c file for testing (which has the main()). Particularly, I have these files all in the same folder (both .c and .h):
“dice”, “game”, “map”, “players”. Then there's “test”, this last one only .c. In all the .h files there's the same type of declaration at the begining (this is from “game.h”):
#ifndef GAME_H
#define GAME_H
#include "dice.h"
#include "map.h"
#include "players.h"
//then there goes the short declaration of the functions in game.c
#endif
The stdio.h is also added in the .c files.
My problem is that I get all the time an error like this: "[Linker Error]: undefined reference to 'whatever_the_function_is_called'" (for like 2 or three functions), and "[Linker Error]: undefined reference to 'WinMain@16'". "Id returned 1 exit status". The only thing I managed to solve is the “WinMain@16” error by adding “void” before the main(), but I've never needed this before. Actually, in an earlier version of the project none of this happened.
I've checked my spelling and looked over the case sensitivity, revised the parameters, checked over that the functions were written on the right place, and tested a lot of other things a bunch of times, but nothing worked.
Could someone help me with this? Any ideas, explanations or anything would be much appreciated.
Thank you in advance!
PD: The main function:
main(){
int i;
char opt = 'a';
t_players pl;
t_map map;
initialize_seed();
initialize_players(&pl);
initialize_regions(&map, &pl);
while(opt != 'n' && opt != 'N'){
print_map(map, pl);
scanf("%c", &opt);
//still to complete
}
}