English:
Ich benutze in meinem Projekt einen externen Verweis auf eine globale Daten Sammlung(keine lib).
Wenn ich eine #define benutzen möchte in einem
#if (a == x(externer define))
kommt ein Fehler Missing binary Operator.
Was kann ich dagegen tun?
In the same file it works, but I must used an external File who it is implemented. By the external reference LPCXpresso make this error, and I don't know why.
this file is one of the first includes, after the system (<string.h> ...) libs.
1) system libs
2) data types
3) this file
4) other def
But I look again the order of this includes.
Best Regards,
Andreas Kullick
the construction:
Best Regards,
Andreas Kullick
There is no problem with what you are trying to do. For example, this (all in a single file) works as you would expect:
#define _ON 1
#define MY_VAR _ON
#if MY_VAR == _ON
#warning ON
#else
#warning OFF
#endif
So, I can only assume that you have something wrong with your #includes. In your diagram above, does your "Using" box know about the "Predefined" box above it?
C (and C++) pre-processor comparisons only works on integers, not strings. Maybe you could explain what you are trying to achieve?
Hi Andreas,
The preprocessor does not know anything about types in the language, so it cannot cast the macro _ON inside the if expression. The `#if' directive will carry out all calculations in the widest integer type known to the compiler; on most machines supported by GCC this is 64 bits.
Could you give us more information on what you are trying to achieve?
Hope it helps!
Best Regards,
Carlos Mendoza
Technical Support Engineer