This won't compile because VS2008 whines about the pre-compiled header "stdafx.h". If I include this header into player.cpp then it will compile. The thing I don't understand is why player.cpp needs to include stdafx.h. Do I have to include the pre-compiled header in every file I create?
Also, in terms of general c++ structure, have I done everything correctly?
I realize I can do this, but I am trying to understand the theory behind it. In my mind it doesn't make sense, what association does player.cpp have with the pre-compiled header?
The Wizard set's up precompiled headers as follows:
- The header that's precompiled is stdafx.h and the file that it's pre-compiled with is stdafx.cpp.
- Each compiled unit must include stdafx.h first so that the compiler can read the precompiled information.
- If you change stdafx.h or a header file that it depends on, you must recompile stdafx.cpp to regenerate the corrected precompiled information and necessarily all the other compiled units too.
Borland implemented a much easier to use precompiled header scheme--but such advanced technology is lost in the mysts of history.