Author Topic: ::wxLogDebug behavior  (Read 4416 times)

Offline Alexis

  • Multiple posting newcomer
  • *
  • Posts: 62
::wxLogDebug behavior
« 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.


Offline Belgabor

  • Multiple posting newcomer
  • *
  • Posts: 91
Re: ::wxLogDebug behavior
« Reply #1 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.

Offline Alexis

  • Multiple posting newcomer
  • *
  • Posts: 62
Re::wxLogDebug behavior [partially solved]
« Reply #2 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 :

  • I added the compilation flag __WXDEBUG__ in my debug project build options. I had forgotten it.  :oops:
  • I added this code in the constructor of my main window :
Code: [Select]
#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.

    Offline Alexis

    • Multiple posting newcomer
    • *
    • Posts: 62
    :wxLogDebug behavior - some problems
    « Reply #3 on: April 11, 2008, 12:19:05 pm »
    Hum sorry, first the compilation flag is wrong. It is not :

    Code: [Select]
    #if defined(__WXDEBUG__) || !defined(__VISUALC__)

    but :

    Code: [Select]
    #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...