Code::Blocks Forums

User forums => Help => Topic started by: Alexis on April 10, 2008, 02:52:30 pm

Title: ::wxLogDebug behavior
Post by: Alexis on April 10, 2008, 02:52:30 pm
When I was using VC++ 2005 Express, I was able to get traces in the Output window by invoking ::wxLogDebug.

I'm striving to do the same under Code::Blocks for Windows (8.02 release). I'd like to get traces when launching my program compiled with MingGW in Debug mode. Traces should appear in Log window, in Debugger thumb, for instance.

Is there a means to do that ? I couldn't find any hint in forum or wiki.

Thanks for your kind help.

Title: Re: ::wxLogDebug behavior
Post by: Belgabor on April 10, 2008, 03:41:53 pm
I don't think so. I usually solve this by creating a wxLogWindow instance in my debug builds.
Title: Re::wxLogDebug behavior [partially solved]
Post by: Alexis on April 10, 2008, 06:16:22 pm
Thanks Belgavor !

I succeeded in displaying logs inside a log windows.
As it could help other people, here is how :

Code
#if defined(__WXDEBUG__) || !defined(__VISUALC__)
    wxFrame* pLogFrame;
    wxLogWindow* m_pLogWindow = new wxLogWindow(this, wxT("Log") );
    pLogFrame = m_pLogWindow->GetFrame();
    pLogFrame->SetWindowStyle(wxDEFAULT_FRAME_STYLE|wxSTAY_ON_TOP);
    pLogFrame->SetSize( wxRect(0,50,400,250) );
    wxLog::SetActiveTarget(m_pLogWindow);
#endif

This code permits to display a log frame always at the same position and always on top.
Title: :wxLogDebug behavior - some problems
Post by: Alexis on April 11, 2008, 12:19:05 pm
Hum sorry, first the compilation flag is wrong. It is not :

Code
#if defined(__WXDEBUG__) || !defined(__VISUALC__)

but :

Code
#if defined(__WXDEBUG__) && !defined(__VISUALC__)

And now, I have link errors when using __WXDEBUG__: 'undefined references to wxAppConsole::OnAssert(wchar_t const*, int, wchar_t const*, wchar_t const*)', for example.

I think I have to recompile wxWidgets with debug symbols...