Sign in to follow this  
woofbluddywoof

printf() in release mode

Recommended Posts

Hi guys - sorry if this is a really dumb question but I'm currently creating my first release build and am having some problems. I'm trying to resolve this by debugging using printf() but nothing's geting outputed to stout (works fine in Debug mode). Do I need to set this up manually or something when running in release mode?

cheers.

Share this post


Link to post
Share on other sites
[quote name='woofbluddywoof' timestamp='1298395408' post='4777585']
Hi guys - sorry if this is a really dumb question but I'm currently creating my first release build and am having some problems. I'm trying to resolve this by debugging using printf() but nothing's geting outputed to stout (works fine in Debug mode). Do I need to set this up manually or something when running in release mode?

cheers.
[/quote]

I would enable debug symbols in release instead of doing printf's. Hopefully you're using windows and visual studio as thats the only platform/IDE I know how to enable it in. Right click your project in the solution explorer, and select properties. Goto "C/C++", and under "Debug Information Format" make sure its set to Zi, next goto the subcategory "optimization", and disable it (/Od). Navigate to the linker tab then subcat "Debugging", and turn "Generate Debug Info" to Yes (/Debug). Clean / rebuild and you should be able to debug in release mode. Do that then nasty printf's!!!

Share this post


Link to post
Share on other sites
In gcc you can use option -g to make sure the debugging information is available.

However, using printf should always work. Try flushing stdout (probably what you mean by "stout") after your call printf (using fflush), or try using stderr instead (which should not be buffered).

Share this post


Link to post
Share on other sites
Hi, thanks for the help guys - setting up the debugging in release is definitely pretty useful so cheers for that.
i also figured out that printf was only not working in the release version when I was running it from inside visual studio (for whatever reason) - just running externally prints out fine.

Thanks for all the help!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this