tmighty
tmighty

Reputation: 11419

C++ VS2010 determine if Release or Debug

I would like to check in C++ 2010 if the build is running as Debug or Release. Is there a simple way to check that?

Thank you.

Upvotes: 7

Views: 6567

Answers (1)

masoud
masoud

Reputation: 56549

VisualStudio generates _DEBUG and NDEBUG as a define. You can check it at compile time.

#ifdef _DEBUG
// THE CODE IS COMPILING IN DEBUG MODE.
#endif

Upvotes: 17

Related Questions