Multiple definition of wxLogTrace linker error

General questions regarding the usage of CodeLite
Navid
CodeLite Enthusiast
Posts: 12
Joined: Fri Jan 30, 2009 8:58 am
Contact:

Multiple definition of wxLogTrace linker error

Post by Navid »

Hi:

Initial attempts to build a test wxWidgets application using the CodeLite wizard failed with the log error below:
----------Build Started--------
"mingw32-make.exe" -j 2 -f "wx_wsp.mk"
----------Building project:[ wx - Debug ]----------
g++ -c "C:/CodeLite/wx/wx_frame.cpp" -g -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:\wx\wxwidgets289\lib\gcc_lib\mswud -IC:\wx\wxwidgets289\include -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -D__WX__ -o ./Debug/wx_frame.o "-IC:/wxMSW-2.8.9/include" "-IC:/wxMSW-2.8.9/lib/gcc_lib/mswu"
g++ -c "C:/CodeLite/wx/wx_app.cpp" -g -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:\wx\wxwidgets289\lib\gcc_lib\mswud -IC:\wx\wxwidgets289\include -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -D__WX__ -o ./Debug/wx_app.o "-IC:/wxMSW-2.8.9/include" "-IC:/wxMSW-2.8.9/lib/gcc_lib/mswu"
g++ -o ./Debug/wx ./Debug/wx_app.o ./Debug/wx_frame.o "-LC:/wxMSW-2.8.9/lib/gcc_lib" -O2 -mthreads -LC:\wx\wxwidgets289\lib\gcc_lib -lwxmsw28ud_html -lwxmsw28ud_adv -lwxmsw28ud_core -lwxbase28ud_xml -lwxbase28ud_net -lwxbase28ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexud -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -mwindows
./Debug/wx_app.o: In function `ZN5WxApp6OnInitEv':
C:/CodeLite/wx/wx_app.cpp:21: undefined reference to `wxXmlResource::Get()'
C:/CodeLite/wx/wx_app.cpp:21: undefined reference to `wxXmlResource::InitAllHandlers()'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/wx] Error 1
mingw32-make.exe: *** [All] Error 2
----------Build Ended----------
2 errors, 0 warnings
Following the recommenations in the thread below (with manually adding the libwxmsw28u_xrc.a library to the linker's libraries in the project):
http://codelite.org/forum/viewtopic.php ... ers+#p1225
I now get a linker error about duplication of wxLogTrace in log.cpp:
----------Build Started--------
"mingw32-make.exe" -j 2 -f "wx_wsp.mk"
----------Building project:[ wx - Debug ]----------
g++ -c "C:/CodeLite/wx/wx_frame.cpp" -g -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:\wx\wxwidgets289\lib\gcc_lib\mswud -IC:\wx\wxwidgets289\include -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -D__WX__ -o ./Debug/wx_frame.o "-IC:/wxMSW-2.8.9/include" "-IC:/wxMSW-2.8.9/lib/gcc_lib/mswu"
g++ -c "C:/CodeLite/wx/wx_app.cpp" -g -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:\wx\wxwidgets289\lib\gcc_lib\mswud -IC:\wx\wxwidgets289\include -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -D__WX__ -o ./Debug/wx_app.o "-IC:/wxMSW-2.8.9/include" "-IC:/wxMSW-2.8.9/lib/gcc_lib/mswu"
g++ -o ./Debug/wx ./Debug/wx_app.o ./Debug/wx_frame.o "-LC:/wxMSW-2.8.9/lib/gcc_lib" -lwxmsw28u_xrc -O2 -mthreads -LC:\wx\wxwidgets289\lib\gcc_lib -lwxmsw28ud_html -lwxmsw28ud_adv -lwxmsw28ud_core -lwxbase28ud_xml -lwxbase28ud_net -lwxbase28ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexud -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -mwindows
C:\wx\wxwidgets289\lib\gcc_lib/libwxbase28ud.a(baselib_log.o): In function `Z10wxLogTracePKwS0_z':
C:/wx/wxwidgets289/build/msw/../../src/common/log.cpp:208: multiple definition of `wxLogTrace(wchar_t const*, wchar_t const*, ...)'
C:\wx\wxwidgets289\lib\gcc_lib/libwxmsw28u_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text$_Z10wxLogTracePKwS0_z[wxLogTrace(wchar_t const*, wchar_t const*, ...)]+0x0): first defined here
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/wx] Error 1
mingw32-make.exe: *** [All] Error 2
----------Build Ended----------
1 errors, 0 warnings, total time: 00:00:12 seconds

The objectionable lines of code being:

Code: Select all

...
void wxVLogTrace(const wxChar *mask, const wxChar *szFormat, va_list argptr)
  {
    if ( wxLog::IsEnabled() && wxLog::IsAllowedTraceMask(mask) ) {
      wxString msg;
      msg << _T("(") << mask << _T(") ") << wxString::FormatV(szFormat, argptr);
          
      wxLog::OnLog(wxLOG_Trace, msg, time(NULL));
    }
  }

/* line 207 */  void wxLogTrace(const wxChar *mask, const wxChar *szFormat, ...)
  {
    va_list argptr;
    va_start(argptr, szFormat);
    wxVLogTrace(mask, szFormat, argptr);
    va_end(argptr);
  }
...

and this has me baffled ... Any suggesitons would be appreciated!

Thanks,

Navid
Navid
CodeLite Enthusiast
Posts: 12
Joined: Fri Jan 30, 2009 8:58 am
Contact:

Re: Multiple definition of wxLogTrace linker error

Post by Navid »

Oops - solved - I had added libwxmsw28u_xrc.a rather than the debug version libwxmsw28ud_xrc.a ...
Post Reply