General Advice... Take smaller steps...
Sorry, this isn't really an answer to your question. (I'm not at my compiler, and I've got to get back to work.)
Take smaller steps. Debugging can get very difficult when the compiler is reporting dozens of errors.
This is becomming one of my standard replies:
Quote:
Start small... Just write enough code so that it compiles. Add a little code at a time, test-compiling and test-running as you proceed. This way you will know right away where the problems are.
It takes a bit of practice to learn how to sequence your program development so that it's testable as you go along. Usually, the user interface, or input/output is started first (but maybe not finalized) so you can see what your program is doing.
Programming is difficult, and every programmer test-compiles and test-runs during development. Beginners should test-compile every line or two! More experienced programmers might only test-compile every "page" or so, depending on how familiar they are with the particular functions they are using, etc.
Also, compilers can get confused... It "knows" that there is a syntax error, but it doesn't know what you were trying to do. This means that the error messages are often misleading. The error message will usually point-to the line with the problem (or the following line).
Linker error messages can be more confusing, because during linking, the line numbers are no longer relevant, and the linker re-names variables and functions. (Name mangling?)