visual studio solution configuration value in C++

Viewed 496

I would like to know if there is a way to get the solution configuration name (debug, release, etc) in the program maybe in a #define ?

I found on the forum this post but the litle function doesn't work for me.

Thanks a lot

1 Answers

Use YOUR_FANCY_NAME="$(ConfigurationName)" in [Configuration Properties] -> [C/C++] -> [Preprocessor] -> [Preprocessor Definitions].

If you don't need the exact name and only want to determine if the current build is a debug build, you can use the preprocessor define _DEBUG:

#ifdef _DEBUG
// stuff
#endif
Related