"#define"d, but undeclared!

Hello,

In the .h file, there are #define statements like:

#define variable1 0
#define variable2 1
...

In the .cpp file, however, whenever the code refers these constants, the compiler says: undeclared identifier. The exception to this is the constructor that goes like:

TheClass::TheClass() {
...
}

Interestingly, I went to a member function which did not recognize these constants and wrote a pragma message like the following:

#pragma message ("variable1 = " STRING(variable1))

and this DOES show the value of variable1 correctly [needless to say, I had put #define STRING2 and #define STRING statements to the beginning of the file].

Could you help me solve this puzzle?

Many thanks.
First, isolate the problem.

Write a separate program (if necessary) that includes just the problem parts.

See if the problem still occurs.

Then post the relevant code.
Topic archived. No new replies allowed.