IsShown - undefined Reference

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
CktDesigner
Earned a small fee
Earned a small fee
Posts: 17
Joined: Mon Sep 21, 2015 5:16 am

IsShown - undefined Reference

Post by CktDesigner »

I'm attempting to upgrade wxWidgets from 3.0.2 to 3.0.4

I compiled and installed the 3.0.4 release, then attempted to re-compile a couple of applications.

Both compiles would not link due to an undefined reference to IsShown(). Here are the errors when trying to compile wxFormBuilder:

Linking wxFormBuilder
obj/Release/wxFormBuilder/maingui.o:(.rodata._ZTV20wxMDIParentFrameBase[_ZTV20wxMDIParentFrameBase]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Release/wxFormBuilder/about.o:(.rodata._ZTV19wxNavigationEnabledI8wxWindowE[_ZTV19wxNavigationEnabledI8wxWindowE]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Release/wxFormBuilder/about.o:(.rodata._ZTV10wxScrolledI7wxPanelE[_ZTV10wxScrolledI7wxPanelE]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Release/wxFormBuilder/about.o:(.rodata._ZTV11AboutDialog[_ZTV11AboutDialog]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Release/wxFormBuilder/about.o:(.rodata._ZTV10HtmlWindow[_ZTV10HtmlWindow]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Release/wxFormBuilder/genericpanel.o:(.rodata._ZTV13GenericWindow[_ZTV13GenericWindow]+0x1f0): more undefined references to `wxWindow::IsShown() const' follow
collect2: error: ld returned 1 exit status
make[1]: *** [../../../output/bin/wxformbuilder] Error 1
make: *** [wxFormBuilder] Error 2

The other application uses files generated using wxFormBuilder, but has similar issues:

obj/Debug/wxFormBuilder_DerivedFiles/OrbInterface.o:(.rodata._ZTV12OrbInterface[_ZTV12OrbInterface]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Debug/wxFormBuilder_DerivedFiles/OrbInterface.o:(.rodata._ZTV20wxMDIParentFrameBase[_ZTV20wxMDIParentFrameBase]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Debug/wxFormBuilder_DerivedFiles/OrbInterface.o:(.rodata._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Debug/wxFormBuilder_DerivedFiles/OrbInterface.o:(.rodata._ZTV15wxAnyButtonBase[_ZTV15wxAnyButtonBase]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Debug/wxFormBuilder_DerivedFiles/OrbPanel.o:(.rodata._ZTV8OrbPanel[_ZTV8OrbPanel]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Debug/wxFormBuilder_DerivedFiles/OrbPanel.o:(.rodata._ZTV10wxScrolledI7wxPanelE[_ZTV10wxScrolledI7wxPanelE]+0x1f0): more undefined references to `wxWindow::IsShown() const' follow
collect2: error: ld returned 1 exit status
Process terminated with status 1 (1 minute(s), 48 second(s))
6 error(s), 17 warning(s) (1 minute(s), 48 second(s))

Since I don't see direct calls to IsShown() in my code (or wxFormBuilder), I'm not sure how to proceed in debugging. Both applications compiled/linked using 3.0.2.

Are there differences between 3.0.2 and 3.0.4 that could cause this?

Thanks!
CktDesigner
Earned a small fee
Earned a small fee
Posts: 17
Joined: Mon Sep 21, 2015 5:16 am

Re: IsShown - undefined Reference

Post by CktDesigner »

Here is the command line for the linker (shows the libraries):

g++ -o bin/Debug/OrbInterface obj/Debug/wxFormBuilder_DerivedFiles/OrbInterface.o obj/Debug/wxFormBuilder_DerivedFiles/OrbPanel.o obj/Debug/OrbInterface/OrbConnected.o obj/Debug/OrbInterface/OrbInterfaceApp.o obj/Debug/OrbInterface/OrbInterfaceMain.o -pthread -lwx_gtk3u_xrc-3.0 -lwx_gtk3u_html-3.0 -lwx_gtk3u_qa-3.0 -lwx_gtk3u_adv-3.0 -lwx_gtk3u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0 /lib/libwx_gtk3u_adv-3.0.so

Doing "nm -D on /usr/lib/libwx_gtk3u_adv-3.0", it looks like "IsShown" is in this library??
CktDesigner
Earned a small fee
Earned a small fee
Posts: 17
Joined: Mon Sep 21, 2015 5:16 am

Re: IsShown - undefined Reference

Post by CktDesigner »

Did one more test. I created a new wxWidgets project in CodeBlocks, then did a build. Here is the output:


-------------- Build: Debug in NewTest (compiler: GNU GCC Compiler)---------------

g++ -I/usr/lib/wx/include/gtk3-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -c /media/sf_Projects/NewProjTest/NewTest/wx_pch.h -o wx_pch.h.gch/Debug_wx_pch_h_gch
g++ -I/usr/lib/wx/include/gtk3-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -c /media/sf_Projects/NewProjTest/NewTest/GUIFrame.cpp -o obj/Debug/GUIFrame.o
g++ -I/usr/lib/wx/include/gtk3-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -c /media/sf_Projects/NewProjTest/NewTest/NewTestApp.cpp -o obj/Debug/NewTestApp.o
g++ -I/usr/lib/wx/include/gtk3-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -c /media/sf_Projects/NewProjTest/NewTest/NewTestMain.cpp -o obj/Debug/NewTestMain.o
g++ -o bin/Debug/NewTest obj/Debug/GUIFrame.o obj/Debug/NewTestApp.o obj/Debug/NewTestMain.o -pthread -lwx_gtk3u_xrc-3.0 -lwx_gtk3u_html-3.0 -lwx_gtk3u_qa-3.0 -lwx_gtk3u_adv-3.0 -lwx_gtk3u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0
obj/Debug/GUIFrame.o:(.rodata._ZTV8GUIFrame[_ZTV8GUIFrame]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Debug/GUIFrame.o:(.rodata._ZTV20wxMDIParentFrameBase[_ZTV20wxMDIParentFrameBase]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Debug/GUIFrame.o:(.rodata._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Debug/NewTestMain.o:(.rodata._ZTV12NewTestFrame[_ZTV12NewTestFrame]+0x1f0): undefined reference to `wxWindow::IsShown() const'
collect2: error: ld returned 1 exit status
Process terminated with status 1 (1 minute(s), 56 second(s))
5 error(s), 0 warning(s) (1 minute(s), 56 second(s))

I assume I did something wrong when I compiled/installed wxWidgets 3.0.4.

Suggestions are welcome!

Thanks!
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: IsShown - undefined Reference

Post by DavidHart »

Hi,

Two questions:
1) Where did you install wx3.0.4? Was it configured as a 'local' install with --prefix=$(pwd), or to prefix $SomewhereElse, or did you let it install to the default /usr/local/? And where is/was the wx3.0.2 build? I'm asking in case you have a linking conflict between two installed versions.

2) How are you trying to build? From within C::B, or in a terminal? If the former, look very carefully at your compiler and linker settings to make sure they are pointing at the same wx. If the latter, or indeed anyway, what is the relevant output of doing, in a terminal:
wx-config --version
wx-config --cxxflags
wx-config --libs

Oh, and I assume you are using the second two wx-config calls when you try to build, rather than pasting in their output by hand...

Regards,

David
CktDesigner
Earned a small fee
Earned a small fee
Posts: 17
Joined: Mon Sep 21, 2015 5:16 am

Re: IsShown - undefined Reference

Post by CktDesigner »

Thanks for your response... I am building on CentOS 7 via a normal terminal window. Here is the output of the commands you requested:

[hepler@centos7 gtk-build]$ wx-config --version
3.0.4
[hepler@centos7 gtk-build]$ wx-config --cxxflags
-I/usr/lib/wx/include/gtk3-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread
[hepler@centos7 gtk-build]$ wx-config --libs
-pthread -lwx_gtk3u_xrc-3.0 -lwx_gtk3u_html-3.0 -lwx_gtk3u_qa-3.0 -lwx_gtk3u_adv-3.0 -lwx_gtk3u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0
[hepler@centos7 gtk-build]$


I configured using:

../configure --with-gtk=3 --prefix=/usr --with-opengl --enable-mediactrl

After the configure, I performed make, then as super-user, performed make install and ldconfig

After trying to recompile a couple of applications (wxformbuilder and one of my own), I created a new wxwidgets project in C::B and simply compiled (no additions or changes) and got:

g++ -I/usr/lib/wx/include/gtk3-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -c /media/sf_Projects/NewProjTest/NewTest/wx_pch.h -o wx_pch.h.gch/Debug_wx_pch_h_gch
g++ -I/usr/lib/wx/include/gtk3-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -c /media/sf_Projects/NewProjTest/NewTest/GUIFrame.cpp -o obj/Debug/GUIFrame.o
g++ -I/usr/lib/wx/include/gtk3-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -c /media/sf_Projects/NewProjTest/NewTest/NewTestApp.cpp -o obj/Debug/NewTestApp.o
g++ -I/usr/lib/wx/include/gtk3-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -c /media/sf_Projects/NewProjTest/NewTest/NewTestMain.cpp -o obj/Debug/NewTestMain.o
g++ -o bin/Debug/NewTest obj/Debug/GUIFrame.o obj/Debug/NewTestApp.o obj/Debug/NewTestMain.o -pthread -lwx_gtk3u_xrc-3.0 -lwx_gtk3u_html-3.0 -lwx_gtk3u_qa-3.0 -lwx_gtk3u_adv-3.0 -lwx_gtk3u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0
obj/Debug/GUIFrame.o:(.rodata._ZTV8GUIFrame[_ZTV8GUIFrame]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Debug/GUIFrame.o:(.rodata._ZTV20wxMDIParentFrameBase[_ZTV20wxMDIParentFrameBase]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Debug/GUIFrame.o:(.rodata._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x1f0): undefined reference to `wxWindow::IsShown() const'
obj/Debug/NewTestMain.o:(.rodata._ZTV12NewTestFrame[_ZTV12NewTestFrame]+0x1f0): undefined reference to `wxWindow::IsShown() const'
collect2: error: ld returned 1 exit status

The linker option within C::B is set to call "wx-config --libs"

Thanks for your assistance...
CktDesigner
Earned a small fee
Earned a small fee
Posts: 17
Joined: Mon Sep 21, 2015 5:16 am

Re: IsShown - undefined Reference

Post by CktDesigner »

Oops... Looks like the wxwidgets build put the results in /usr/lib (per the --prefix configuration) while C::B and the wxformbuilder must have been looking in /usr/lib64

I copied all of the /usr/lib/libwx_gtk3... files to /usr/lib64 and things seem to work!

Thanks!
Post Reply