Odd error on header file inclusion
I just got some strange error when including a header file. It's a lot of code, but I'm really clueless on why this happens and how to fix it.
Full code: http://www.sitiodosnetos.com/v3.6.zip
(most comments are in portuguese, apologies for that)
I have a structure 'line', which will contain a dynamic array of pointers to structure 't_location'. Structure 't_location' will also have a dynamic array of pointers to structure 'line'.
Each structure is declared in a separate file (line.h and t_location.h), along with specific function prototypes that belong to each of the structures.
So far no problem, since the C compiler won't complain as they are pointers to undeclared structures.
When I '#include "line.h"' at t_location.h, no problem at all, everything compiles like it should.
When I '#include "t_location.h"' at line.h, some very strange errors happen:
where line:h:8 contains '#include "t_location.h"' only.
user@pc-name:~/directory$ make all
gcc -ansi -pedantic -Wall -c -main.c
In file included from line.h:8
t_location.h:12: error: expected specifier-qualifier-list before 'Line'
t_location.h:15: error: expected ')' before '*' token
t_location.h:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
t_location.h:23: error: expected delcaration specifiers or '...' before 'Line'
make: *** [main.o] Error 1
This is a tetris-related application. It will read a list of moves and will output the final state of the game (unlimited lines), plus an integer 'score', the number of lines printed, the content of the line in the median position of a insert-sorted (free positions removed) list of deleted lines, plus information about every piece that remains fully in the game.
To archieve this, every line will have a variable-sized array that will point to information about the pieces in the line.
Consequently, each piece will have a veriable-sized array that will point to the lines the piece is currently in (to prevent double-eliminations of the same piece).