View Full Version : C++ Switching between debug and Release

01-02-2012, 09:27 AM
I'm using Code::Blocks to program in C++. I want to be able to have some code no be compiled in Release mode, while when I'm in Debug mode, the code won't compile. Specifically, I the compiler to skip over all the std::cout commands when in debug mode.

I know how to make the console window not show up in release mode, but If the console window isn't going to show up, then having the std::cout commands in the release version is a waste since they won't be readable.

How can I make this happen without having to comment out each std::cout line manually?

01-05-2012, 01:24 AM
Use conditional macros and then you can enable or disable that code at build time. Just like this