#Conditional compilation for debug
10 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
!cppref if constexpr
int main() {
if constexpr(true) {
printf("hi");
}
}
Alternatively
int main() {
#ifdef DEBUG
printf("hi");
#endif
}
Thanks
There's also _DEBUG switch which is also enabled only in debug builds. For example, MSVC-specific assertions only work with this switch. I recommend checking for both:
#if defined(DEBUG) || defined(_DEBUG)
printf("hi!");
#endif
This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.