User forums > Help

::wxLogDebug behavior

(1/1)

Alexis:
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.

Belgabor:
I don't think so. I usually solve this by creating a wxLogWindow instance in my debug builds.

Alexis:
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: ---#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
--- End code ---

This code permits to display a log frame always at the same position and always on top.

Alexis:
Hum sorry, first the compilation flag is wrong. It is not :


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

--- End code ---

but :


--- Code: ---#if defined(__WXDEBUG__) && !defined(__VISUALC__)
--- End code ---

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...

Navigation

[0] Message Index

Go to full version