I mean literally what I say. I don't understand why it's being reset, and that's why I'm here. I compile the program and run it, but when I output ACTIVATE, it's 17 not 12.
I #define it in main like you see above, then in every other file that uses the pin (playRecord.h and playRecord.cpp) I #include later, and I use
1 2 3 4
|
#ifndef ACTIVATE
#define ACTIVATE
#define RECORD
#endif
|
in those files like you see above.
When I output the pin later in playRecord.cpp, it is not 12 as I expect it to be, but 17. From what I understand from the above and from classes I've taken and books and webpages I've read. If you #define something before you #include something with #ifndef, then the #ifndef should not be evaluated for that program, but that's not what I'm experiencing. So, I'm asking to see if my assumptions are wrong or if it has something to do with the way I'm compiling the code that is causing this prolem.
From what you're saying, though, it seems I am mistaken, and that when I run the compiler, the volume.cpp and playRecord.cpp don't get the same values in the volume.cpp and playRecord.cpp because the values are not defined according to them? So when the program compiles the values in volume.cpp and playRecord.cpp will take the default values despite main defining them before the inclusion?