Page 1 of 1

Problems with wxStyledTextCtrl etc. on Xubuntu 14.04

Posted: Fri Jul 11, 2014 7:37 am
by imalipusram
Dear Experts,

Serious trouble to get a simple hello world example working on Xubuntu 14.04 LTE Trusty. I suppose some missing libraries, as the errors occur in the code generated by wxCrafter.

I followed the instructions on codelite.org for installing wxWidgets. When I remove the wxStyledTextCtrl, the code compiles. Similar error messages show up with eg. wxRichTxtCtrl

wxcrafter.h contains the line
#include <wx/stc/stc.h>

These are (probably corresponding) libraries installed on my system:

Code: Select all

wo@7of9:~$ sudo find / -name libwx_gtk2u_stc*
[sudo] password for wo: 
/home/wo/PyRx-0.9/lib/wx-2.8/libwx_gtk2u_stc-2.8.so.0.7.0
/home/wo/PyRx-0.9/lib/wx-2.8/libwx_gtk2u_stc-2.8.so
/home/wo/PyRx-0.9/lib/wx-2.8/libwx_gtk2u_stc-2.8.so.0
/usr/lib/x86_64-linux-gnu/libwx_gtk2u_stc-3.0.so.0.0.0
/usr/lib/x86_64-linux-gnu/libwx_gtk2u_stc-2.8.so.0.8.0
/usr/lib/x86_64-linux-gnu/libwx_gtk2u_stc-2.8.so.0
/usr/lib/x86_64-linux-gnu/codelite/libwx_gtk2u_stc-3.0.so.0.0.0
/usr/lib/x86_64-linux-gnu/codelite/libwx_gtk2u_stc-3.0.so.0
/usr/lib/x86_64-linux-gnu/codelite/libwx_gtk2u_stc-3.0.so
/usr/lib/x86_64-linux-gnu/libwx_gtk2u_stc-3.0.so.0
wo@7of9:~$ 
Any ideas what's missing / what could be wrong?

The error messages are (full context at the end of the post)

./Debug/wxcrafter.cpp.o: In function `MainFrameBaseClass::MainFrameBaseClass(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long)':

/home/wo/.codelite/versapump3/helloworld_frame/wxcrafter.cpp:50: undefined reference to `wxSTCNameStr'
/home/wo/.codelite/versapump3/helloworld_frame/wxcrafter.cpp:50: undefined reference to `wxStyledTextCtrl::wxStyledTextCtrl(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&)'
/home/wo/.codelite/versapump3/helloworld_frame/wxcrafter.cpp:52: undefined reference to `wxStyledTextCtrl::SetMarginType(int, int)'
/home/wo/.codelite/versapump3/helloworld_frame/wxcrafter.cpp:53: undefined reference to `wxStyledTextCtrl::SetMarginMask(int, int)'

...
[many more alike errors with wxStyledTextCtrl follow]
...
/home/wo/.codelite/versapump3/helloworld_frame/wxcrafter.cpp:233: undefined reference to `wxStyledTextCtrl::SetKeyWords(int, wxString const&)'
/home/wo/.codelite/versapump3/helloworld_frame/wxcrafter.cpp:234: undefined reference to `wxStyledTextCtrl::SetKeyWords(int, wxString const&)'


I'm trying to teach myself C++ with a real world application and am still bloody wet behind my ears, so please excuse my ignorance.

Thanks for your help!

Wo

Code: Select all

/bin/sh -c '/usr/bin/make -j2 -e -f  Makefile'
----------Building project:[ helloworld_frame - Debug ]----------
make[1]: Entering directory `/home/wo/.codelite/versapump3/helloworld_frame'
/usr/bin/g++  -o ./Debug/helloworld_frame @"helloworld_frame.txt" -L.   -L/usr/lib/x86_64-linux-gnu -pthread   -lwx_gtk2u_unofficial_xrc-3.0 -lwx_gtk2u_unofficial_webview-3.0 -lwx_gtk2u_unofficial_html-3.0 -lwx_gtk2u_unofficial_qa-3.0 -lwx_gtk2u_unofficial_adv-3.0 -lwx_gtk2u_unofficial_core-3.0 -lwx_baseu_unofficial_xml-3.0 -lwx_baseu_unofficial_net-3.0 -lwx_baseu_unofficial-3.0
./Debug/wxcrafter.cpp.o: In function `MainFrameBaseClass::MainFrameBaseClass(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long)':

/home/wo/.codelite/versapump3/helloworld_frame/wxcrafter.cpp:50: undefined reference to `wxSTCNameStr'
/home/wo/.codelite/versapump3/helloworld_frame/wxcrafter.cpp:50: undefined reference to `wxStyledTextCtrl::wxStyledTextCtrl(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&)'
/home/wo/.codelite/versapump3/helloworld_frame/wxcrafter.cpp:52: undefined reference to `wxStyledTextCtrl::SetMarginType(int, int)'
/home/wo/.codelite/versapump3/helloworld_frame/wxcrafter.cpp:53: undefined reference to `wxStyledTextCtrl::SetMarginMask(int, int)'[/color]
...
[many more alike errors with wxStyledTextCtrl follow]
...
/home/wo/.codelite/versapump3/helloworld_frame/wxcrafter.cpp:233: undefined reference to `wxStyledTextCtrl::SetKeyWords(int, wxString const&)'
/home/wo/.codelite/versapump3/helloworld_frame/wxcrafter.cpp:234: undefined reference to `wxStyledTextCtrl::SetKeyWords(int, wxString const&)'
collect2: error: ld returned 1 exit status
make[1]: *** [Debug/helloworld_frame] Error 1
make[1]: Leaving directory `/home/wo/.codelite/versapump3/helloworld_frame'
make: *** [All] Error 2
133 errors, 0 warnings

Re: Problems with wxStyledTextCtrl etc. on Xubuntu 14.04

Posted: Fri Jul 11, 2014 9:05 am
by eranif
Its simple: you need to add stc to the linker settings.
Right click on your project and select -> Settings->Common Settings->Linker

Under the 'Linker Options'
change this line:

Code: Select all

$(shell wx-config --debug=yes --libs --unicode=yes)
to

Code: Select all

$(shell wx-config --debug=yes --libs std,stc,richtext --unicode=yes)
All the wxStyledTextCtrl is placed in a different wxWidgets library 'stc'
The --libs flag allows you specify which components of wxWidgets you are interested. By default, wxCrafter only uses the 'default' one

Eran

Re: Problems with wxStyledTextCtrl etc. on Xubuntu 14.04

Posted: Fri Jul 11, 2014 9:27 am
by imalipusram
Dear eranif,

your suggestion is highly appreciated. Thanks!

(it works, of course)