[SOLVED] Link error while using wxToggleButton in GNU/Linux

Guillermo Torreiro gtlists at gmail.com
Thu Jun 7 07:34:31 PDT 2007


When linking, the list of libs were something like:
    1) wxwidgets' libs
    2) my libs ( depending on wxwidgets' )

With just swapping the list order, this link error disappear:
    1) my libs ( depending on wxwidgets' )
    2) wxwidgets' libs

I was puzzled about why with some controls ( wxButton, wxRadioButton,
... ) there wasn't any link error but, there was with wxToggleButton
in particular.

I mean; Why the linker found the definition for wxButton, and not for
wxToggleButton ?. Both controls comes from the same library.

wx's libs were statically compiled ( monolithic build ).

Does anyone feels like to give some insight about this link error
being that way ?

Best Regards,
GT

On 6/7/07, Guillermo Torreiro <gtlists at gmail.com> wrote:
> Hello,
>
> I've been trying to solve this link error but I've run out of ideas.
>
> g++ -o TestApp UIMainWindow.o application.o
> `/usr/local/src/wxGTK-2.8.4/GCCBuildReleaseGTK2Unicode/wx-config
> --inplace --exec-prefix="/usr/local/src/wxGTK-2.8.4/GCCBuildReleaseGTK2Unicode"
> --libs` -lUITabTest -lmodule -L.
> ./libUITabTest.a(UITabTest.o): In function `UITabTest::CreateControls()':
> UITabTest.cc:(.text+0x49a): undefined reference to `vtable for wxToggleButton'
> UITabTest.cc:(.text+0x4d6): undefined reference to
> `wxToggleButton::Create(wxWindow*, int, wxString const&, wxPoint
> const&, wxSize const&, long, wxValidator const&, wxString const&)'
> UITabTest.cc:(.text+0x510): undefined reference to
> `wxToggleButton::SetValue(bool)'
> collect2: ld returned 1 exit status
> make[1]: *** [TestApp] Error 1
> make[1]: Leaving directory `/home/lab/c++/wxToggleButtonProblem'
> make: *** [all] Error 2
>
> This error occur using either wxGTK-2.8.0 or wxGTK-2.8.4
>
> This problem doesn't occur when making a "hello world" type of
> application; in that case, when using the wxToggleButton, everything
> compiles just fine.
>
> I have tested this same project under Windows using wxMSW-2.8.3 and it
> didn't present any errors at all.
>
> The code is hosted here:
> http://files-upload.com/277950/wxToggleButtonProblem.rar.html
>
> It's easy to use since it has makefiles ready to compile it; so it
> should be straight forward to give it a try and see what's happening;
> Just type make =)
>
> Development environment on GNU/Linux:
> gtk+ 2.10.12
> gcc   4.1.2
> make  3.81
> wxGTK 2.8.4 (gtk2, unicode)
>
> Development environment on Windows:
> WindowsXP SP2
> Borland Turbo C++ Explorer Edition ( bcc 5.82 )
> wxMSW 2.8.3 (unicode)
>
> wxGrid, wxCalendarCtrl, wxSplitterWindow, wxSashWindow, wxSpinButton,
> wxSpinCtrl, wxScrollBar presents the same problems when used in this
> test project.
>
> Best Regards,
> GT
>




More information about the wx-users mailing list