I have a file called program.hpp. In this file i have defined a large amount of constants with #define, and i have two function definitions.
In my main file, program.cpp, i have another #define, which i want to depend on my current program, not the header file , program.hpp. Let's call this constant TEMPO ( it's the actual name of the constant).
In program .hpp, my 2 functions have a block of code which looks like this
void function(int arg1, int arg2, int arg 3)
{
float time;
#ifdef TEMPO
time=TEMPO;
#else
time=500;
#endif
//rest of code
}
Notice again, TEMPO is defined in the main file, program.cpp.Now, in the include list of program.cpp, i have also included music.hpp (duh).
But when i call the functions i need in program.cpp, they act as if i have not defined TEMPO, so they put the default value of 500, which i have set in case i forgot to define TEMPO.
Any ideas? Why isn't the function recognising the constant, and if this is how it works, how can i find a way around to solve this issue? thank you very much.


Sign In
Create Account


Back to top









