Page 1 of 1
wxRichTextCtrl undefined reference
Posted: Tue Nov 19, 2019 6:39 am
by coder99
Being a bit of a newb to the Linux side of both Codelite (CL) (13.0.5) & wxWidgets (3.1.2 manually built from Github code without issues)), I have installed both of these on a Mint box ( Mint Cinnamon 19.2)
The project I want to port from Windows, where it all compiles and runs, uses a wxRichTextCtrl window and the Codelite linker complains about the undefined reference.
As it is, I have no real clue where or how I would fix this, being used to multi-lib static linking under Windows
I can find my wxWidgets libraries and am prepared to give dynamic liking a try as some other basic wxWidgets app seem to compile and run, mainly the CL demo app.
Re: wxRichTextCtrl undefined reference
Posted: Tue Nov 19, 2019 2:22 pm
by DavidGH
Hi,
wxWidgets (3.1.2 manually built from Github code without issues)
What was your configure line? In particular, a static or dynamic build?
Codelite linker complains about the undefined reference
(Nitpick: The Mint linker. CL creates a makefile that calls the compiler and linker, it doesn't actually build the program itself.)
What does your Project Settings: Linker > Linker Options field contain? For a dynamic-linking wx it should be something like:
$(shell wx-config --libs std,richtext)
Regards,
David
Re: wxRichTextCtrl undefined reference
Posted: Tue Nov 19, 2019 9:15 pm
by coder99
Thank you.
That last part about "$(shell wx-config --libs std,richtext)" did the trick.
As for the static vs dynamic linking, I will have to explore down the road because for now I have only compiled the dynamic libs of wxWidgets.
If you can point me in the right direction on what I need to know to get static linking set up, I'll be very grateful. I understand Linux apps are typically set to use dynamic linking but as I am just as unfamiliar with packaging the app and all its dependencies so that I can give the app to someone else without too much fuss, I prefer to look at a statically linked package.
Re: wxRichTextCtrl undefined reference
Posted: Tue Nov 19, 2019 10:28 pm
by DavidGH
If you can point me in the right direction on what I need to know to get static linking set up
Just make a wx build doing, in the extracted wx source, something like:
mkdir disable-shared && cd disable-shared
../configure --disable-shared <--enable-debug --with-gtk=$(number) --whatever>
make -j`nproc`
I almost always add --prefix=$(pwd) to the configure line for such builds. That means they don't need to be 'make installed', you can use them where they are; you'd point to that dir's wx-config in your makefile or CL Compile and Linker settings. So your new Linker settings would be similar to:
$(shell /full/path/to/disable-shared/wx-config --libs std,richtext)
Re: wxRichTextCtrl undefined reference
Posted: Wed Nov 20, 2019 12:20 am
by coder99
Thank you.
I'll give this a try, once I get the dynamic version working well enough;
still have some porting issues to resolve.
Re: wxRichTextCtrl undefined reference
Posted: Tue Nov 26, 2019 7:23 am
by coder99
Now that I have the dynamically linked version working as well as I need for the time being, I have started to try and implement the statically linked version. For the record & in case I need to come back to this:
I have executed the commands:
mkdir disable-shared && cd disable-shared
../configure --disable-shared --enable-debug --with-gtk=2 --prefix=$(pwd)
make -j4
and as far as I can tell, that all worked
Next I have changed the c++ compiler options to: $(shell ~/wxWidgets-3.1.2/disable-shared/wx-config --cflags)
and the linker options:$(shell ~/wxWidgets-3.1.2/disable-shared/wx-config --libs )
with the Libraries:
libwx_baseu-3.1
libwx_baseu_net-3.1
libwx_baseu_xml-3.1
libwx_gtk2u_adv-3.1
libwx_gtk2u_aui-3.1
libwx_gtk2u_core-3.1
libwx_gtk2u_gl-3.1
libwx_gtk2u_html-3.1
libwx_gtk2u_propgrid-3.1
libwx_gtk2u_qa-3.1
libwx_gtk2u_ribbon-3.1
libwx_gtk2u_richtext-3.1
libwx_gtk2u_stc-3.1
libwx_gtk2u_xrc-3.1
libwxjpeg-3.1
libwxregexu-3.1
libwxscintilla-3.1.a
curl.a
All compiles, links and executes and runs as well as the dynamically linked version
Big thank you to DavidGH