Author Topic: Problem with compiling/linking the wxdba libraries in Code::Blocks  (Read 4871 times)

Offline ascii_moe

  • Multiple posting newcomer
  • *
  • Posts: 13
Hi all,

I have a little problem with compiling/linking the wxdba libraries in Code::Blocks.
At first I tried to compile the following code snippet and received an "undefined reference" error message:

Code
[...]
wxDbConnectInf *DbConnectInf;
DbConnectInf = new wxDbConnectInf(NULL, "DATABASE", "USERNAME", "PASSWORD");
wxDb sampleDB(DbConnectInf->GetHenv());
[...]

obj/Debug/DBconnectMain.o||In function `DBconnectFrame::DBconnect(wxCommandEvent&)':|
DBconnectMain.cpp|185|undefined reference to `wxDbConnectInf::wxDbConnectInf(void*, wxString const&, wxString const&, wxString const&, wxString const&, wxString const&, wxString const&)'|

OK, so I added "wxdba" to "Link libraries" in the "Linker settings" tab (Settings / Compiler and debugger... / Global compiler settings) and "/usr/local/include" and "/usr/local/include/wxdba" to the "Search directories / Linker" tab.
Now the "undefined reference" doesn't occur any longer, but instead I get:

Code
cannot find -lwxdba

But why? As far as I can say, the entries in the CB configuration mentioned above seem to bee correct:

Code
/usr/local/bin/wxdba-config
/usr/local/include/wxdba
/usr/local/include/wxdba/array_filter.h
/usr/local/include/wxdba/colour_filter.h
/usr/local/include/wxdba/connectstring.h
/usr/local/include/wxdba/csvarchive.h
/usr/local/include/wxdba/csvistream.h
/usr/local/include/wxdba/csvostream.h
/usr/local/include/wxdba/database.h
/usr/local/include/wxdba/date_filter.h
/usr/local/include/wxdba/datespan_filter.h
/usr/local/include/wxdba/datetime_filter.h
/usr/local/include/wxdba/dbconfeditor.h
/usr/local/include/wxdba/dbconnection.h
/usr/local/include/wxdba/dbplugin.h
/usr/local/include/wxdba/dbresult.h
/usr/local/include/wxdba/defs.h
/usr/local/include/wxdba/exception.h
/usr/local/include/wxdba/float32_filter.h
/usr/local/include/wxdba/font_filter.h
/usr/local/include/wxdba/list_filter.h
/usr/local/include/wxdba/pagesetupdialogdata_filter.h
/usr/local/include/wxdba/sql.h
/usr/local/include/wxdba/sqlarchive.h
/usr/local/include/wxdba/sqlistream.h
/usr/local/include/wxdba/sqlostream.h
/usr/local/include/wxdba/sqlutils.h
/usr/local/include/wxdba/streamhelper.h
/usr/local/include/wxdba/string_filter.h
/usr/local/include/wxdba/timespan_filter.h
/usr/local/include/wxdba/transaction.h
/usr/local/include/wxdba/wxfiltersbase.h
/usr/local/include/wxdba/wxfiltersgui.h
/usr/local/include/wxdba/wxutils.h
/usr/local/include/wxdba/wxutilsgui.h
/usr/local/include/wxdba/xmlarchive.h
/usr/local/include/wxdba/xmlistream.h
/usr/local/include/wxdba/xmlostream.h
/usr/local/lib/libwxdba-base.a
/usr/local/lib/libwxdba-gui.a
/usr/local/share/bakefile/presets/wxdba.bkl

Can anyone help?

Thanks & regards,
    Thomas

Offline ascii_moe

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Problem with compiling/linking the wxdba libraries in Code::Blocks
« Reply #1 on: August 06, 2010, 12:53:28 pm »
... hm, ok. At least a little(!) success:

I recompiled dba-1.4.1 and wxdba-1.4.1 and installed them again.
But this time i compiled them with "--enable-shared".
After this I added "dba", "wxdba-base" and "wxdba-gui" to "Linker Settings / Link libraries" in CB and tried to compile the program, again:

Code
Linking executable: bin/Debug/DBconnect
/usr/local/lib/libwxdba-base.so: undefined reference to `wxTimeSpan::Format(wchar_t const*) const'
/usr/local/lib/libwxdba-gui.so: undefined reference to `wxString::Format(wchar_t const*, ...)'
/usr/local/lib/libwxdba-gui.so: undefined reference to `wxStringBase::InitWith(wchar_t const*, unsigned long, unsigned long)'
/usr/local/lib/libwxdba-gui.so: undefined reference to `wxString::Find(wchar_t, bool) const'
/usr/local/lib/libwxdba-gui.so: undefined reference to `wxStringBase::ConcatSelf(unsigned long, wchar_t const*, unsigned long)'
/usr/local/lib/libwxdba-base.so: undefined reference to `wxStringBase::wxStringBase(unsigned long, wchar_t)'
/usr/local/lib/libwxdba-gui.so: undefined reference to `wxString::mb_str(wxMBConv const&) const'
/usr/local/lib/libwxdba-gui.so: undefined reference to `wxWindow::ApplyToolTip(_GtkTooltips*, wchar_t const*)'
/usr/local/lib/libwxdba-gui.so: undefined reference to `wxString::Cmp(wchar_t const*) const'
/usr/local/lib/libwxdba-gui.so: undefined reference to `wxStringBase::operator=(wchar_t const*)'
/usr/local/lib/libwxdba-base.so: undefined reference to `wxString::wxString(char const*, wxMBConv const&, unsigned long)'
/usr/local/lib/libwxdba-base.so: undefined reference to `wxDateTime::Format(wchar_t const*, wxDateTime::TimeZone const&) const'

So, now it seems that the libraries are being found correctly, but what about the remaining "undefined reference" error messages?
How can I solve this?

Any ideas?


Regards,
Thomas

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Problem with compiling/linking the wxdba libraries in Code::Blocks
« Reply #2 on: August 06, 2010, 02:16:48 pm »
This is NOT an Code::Blocks question; but, are you using Unicode for both wxWidgets and wxDba as is required.

Edit1: I very strongly suggest turning on Full Compiler Logging; read the CB Wiki FAQ for directions.
Edit2: You do realize that the order of library matter in the linker step; make sure wxDba ones are correct relative to wxWidgets.

Tim S.
« Last Edit: August 06, 2010, 02:23:08 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org