Page 2 of 2

Re: wxsqlite3.cpp: Undefined reference to `wxRegEx::~wxRegEx()'- Linux

Posted: Tue Jun 13, 2017 6:27 am
by utelle
Looking at the compile/link command line you added in one of your previous posts afterwards, I see

g++ -L/usr/local/lib -o bin/Debug/db_Connect_GUI obj/Debug/db_Connect_GUIApp.o obj/Debug/db_Connect_GUIMain.o -L/usr/lib/x86_64-linux-gnu -pthread -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0 -lsqlite3 -lcurl /usr/local/lib/libwxcode_gtk3u_wxsqlite3-3.0.a /usr/local/lib/libwxregexu-3.0.a

And this explains your problem. As I said under Linux the link library order matters. You have to specify the wxSQLite3 library first to resolve its wxWidgets related symbols. Your command/link command line should look more like the following:

g++ -L/usr/local/lib -o bin/Debug/db_Connect_GUI obj/Debug/db_Connect_GUIApp.o obj/Debug/db_Connect_GUIMain.o -L/usr/lib/x86_64-linux-gnu -pthread /usr/local/lib/libwxcode_gtk3u_wxsqlite3-3.0.a -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0 -lsqlite3 -lcurl /usr/local/lib/libwxregexu-3.0.a

I'm not sure about where /usr/local/lib/libwxregexu-3.0.a should be placed, but AFAIK it should be ok to leave it at the end of the list.

Nevertheless, as David Hart explained the best option would be to use wx-config to determine the list of required wx libraries.

Regards,

Ulrich