Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    C++ Switching between debug and Release

    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?

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Use conditional macros and then you can enable or disable that code at build time. Just like this
    http://stackoverflow.com/questions/1...pile-time-in-c
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •