Finishing Compiling
- We have broken our code across several files.
- See this code for one possible full deconstruction.
- Notice that some constants are stored in a .h file GameConstants.h
- They have no corresponding .cpp file.
- They are just constants for the game.
- The final compile diagram looks like this
-
- I have only included two of the other files.
- There are actually many others.
- Remember, with rare exceptions
- Don't put executable code in the header files.
- Don't #include .cpp files.
- Don't put
using namespace std
in .h files
- Do build a Makefile to automate compiling.
- If you need utility functions that you don't wish to expose to the outside world
- Just put them in the .cpp file.
- Don't worry about adding them to the .h file.