When I have in my code an #ifdef
like this
#ifdef _DEBUG
printf("This is a debug build");
#endif
Qt Creator grays out the printf
even though it is a debug build, and when I run it "This is a debug build"
gets printed.
It seems that the intellisense isn't seeing the preprocessor defines that will be passed to the compiler via the command line (i.e. -D_DEBUG
) instead of being defined in the header/source files.