| Author |
How to output debug in release build?
|
|
| Dhruba Bandopadhyay 2006-03-17, 7:58 am |
| Hi
I am using MFC. I am wondering if it's possible to output some
debugging/error messages but not in debug mode.
Somehow my application crashes and doesn't work in debug build. So am stuck
in release build. But I really need to output some debugging/error messages.
I've tried:
#include <iostream>
std::err << "hello" << std::endl;
but nothing shows...
| |
| Michael Archon Sequoia Nielsen 2006-03-17, 7:58 am |
| Dhruba Bandopadhyay wrote:
> Hi
>
> I am using MFC. I am wondering if it's possible to output some
> debugging/error messages but not in debug mode.
>
> Somehow my application crashes and doesn't work in debug build. So am stuck
> in release build. But I really need to output some debugging/error messages.
>
> I've tried:
>
> #include <iostream>
> std::err << "hello" << std::endl;
>
> but nothing shows...
You could use fprintf to a FILE *myLogFile.
| |
| Tim Ward 2006-03-17, 7:01 pm |
| "Dhruba Bandopadhyay" <dhruba.bandopadhyay@hotmail.com> wrote in message
news:etbwg3bSGHA.4976@TK2MSFTNGP11.phx.gbl...
>
> I am using MFC. I am wondering if it's possible to output some
> debugging/error messages but not in debug mode.
>
> Somehow my application crashes and doesn't work in debug build. So am
stuck
> in release build. But I really need to output some debugging/error
messages.
Well, you can mess around with hybrid debug-release builds, with debug
output turned on and also compiler optimisation turned on, that sort of
thing, but it can be hard work.
To answer your actual question, OutputDebugString does what you request
(it's what TRACE would be using if it weren't disabled in non-debug builds).
Then run the program under the debugger.
--
Tim Ward
Brett Ward Limited - www.brettward.co.uk
| |
| Tom Serface 2006-03-17, 7:01 pm |
| This is an interesting article:
http://www.codeproject.com/debug/survivereleasever.asp
Tom
"Dhruba Bandopadhyay" <dhruba.bandopadhyay@hotmail.com> wrote in message
news:etbwg3bSGHA.4976@TK2MSFTNGP11.phx.gbl...
> Hi
>
> I am using MFC. I am wondering if it's possible to output some
> debugging/error messages but not in debug mode.
>
> Somehow my application crashes and doesn't work in debug build. So am
> stuck in release build. But I really need to output some debugging/error
> messages.
>
> I've tried:
>
> #include <iostream>
> std::err << "hello" << std::endl;
>
> but nothing shows...
>
>
>
| |
| Ben Voigt 2006-03-20, 7:02 pm |
|
"Dhruba Bandopadhyay" <dhruba.bandopadhyay@hotmail.com> wrote in message
news:etbwg3bSGHA.4976@TK2MSFTNGP11.phx.gbl...
> Hi
>
> I am using MFC. I am wondering if it's possible to output some
> debugging/error messages but not in debug mode.
>
> Somehow my application crashes and doesn't work in debug build. So am
> stuck in release build. But I really need to output some debugging/error
> messages.
>
> I've tried:
>
> #include <iostream>
> std::err << "hello" << std::endl;
That's std::cerr, right?
In VC++ 6, cout and cerr have type ostream_withassign, so they are easily
redirected. See
http://msdn.microsoft.com/library/d...perator_.3d.asp
>
> but nothing shows...
>
>
>
|
|
|
|