...

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



Croolsby
01-02-2012, 10: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?

Spookster
01-05-2012, 02:24 AM
Use conditional macros and then you can enable or disable that code at build time. Just like this
http://stackoverflow.com/questions/1304174/how-to-strip-debug-code-during-compile-time-in-c



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum