I have a set of 3 header files, each of which consists of a class. Additionally, I have a main.cpp file in which the main function resides. I am having no trouble compiling and running the files. That being the case I created some global constants, which reside in the main file. The idea being that I could use these constants in some of the class header files. When I use the global constants in the header files I can see that the constants are recognized in the file that I place the constant. However, they will not compile and I get the following error message in each place I used the global constant:
1>f:\school\cs161\chapter problems\chap8prob4\monkey.h(19): error C2065: 'MONKEYS' : undeclared identifier
While this is just an experiment and I do not have to use them this way, I really cannot understand why the header files appear to recognize the global constants from the main file but will not compile them.
Can anyone explain this to me?