> So, you're telling me that C++, a powerful programming language that's
powering operating systems and state-of-the-art games, isn't powerful enough
to define a simple conditional statement?
No, I'm telling you that C++ is a compiled language, and #define (and other
statements starting with a hash) is not even C++ code, but a C++ preprocessor
directive which is executed at compile-time. It's simply not possible to use
code executed at compile-time to do something at run-time.
> What do you mean by that USE_KCHMVIEWER isn't a variable?
It's a preprocessor-defined constant. This is not the same as a variable, and
as I said, it's not technically possible to change it after the program has
been compiled.
For example, if you have this:
#define FOO ((5 + 3) / 2)
Then the preprocessor goes through all the relevant C++ code before compiling
and replaces all instances of "FOO" with "((5 + 3) / 2)". So for example,
this:
int x = FOO;
becomes this:
int x = ((5 + 3) / 2);
So a compiled binary never sees that "FOO" constant. It only sees "((5 + 3) /
2)".
> What would be the preferred way to work around this (i.e. what should I use
instead of # ifdef USE_KCHMVIEWER, and # if !defined USE_KCHMVIEWER)?
As I said, use variables. (Or, depending on the specifics, a constant defined
with the const keyword). It needs to be all based on C++ code, not
preprocessor directives, because preprocessor directives are all handled at
compile-time.