Can't link DBA library Topic is solved

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
maxbld
Earned some good credits
Earned some good credits
Posts: 113
Joined: Wed Jan 30, 2013 10:49 pm

Can't link DBA library

Post by maxbld »

Dear all,

I compiled the debea libraries DBA and wxDBA, both with nmake, the VS2010 make tool, since with mingw32-make from TDM-MinGW I had no luck: For some mysterious reason it doesn't compile dba.lib, I found on the internet posts regarding the problem but they hadn't any useful answer (see: https://groups.google.com/forum/?fromgr ... GndgoVswBw).

To make it compile I had to patch a few things, but it's quite documented in the internet...

Anyway now here I am with the (nmake) compiled library, but when I include it in my code it fails at linking:

Code: Select all

D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\database.h|170|warning: multi-line comment [-Wcomment]|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\sql.h||In constructor 'dba::SQL::VarData::VarData(void*, const char*, const char*, int)':|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\sql.h|233|warning: 'dba::SQL::VarData::mFilter' will be initialized after [-Wreorder]|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\sql.h|230|warning:   'const char* dba::SQL::VarData::mSQLName' [-Wreorder]|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\sql.h|210|warning:   when initialized here [-Wreorder]|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\sql.h||In constructor 'dba::SQL::VarData::VarData(dba::StoreableFilterBase*, const char*, int)':|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\sql.h|233|warning: 'dba::SQL::VarData::mFilter' will be initialized after [-Wreorder]|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\sql.h|230|warning:   'const char* dba::SQL::VarData::mSQLName' [-Wreorder]|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\sql.h|218|warning:   when initialized here [-Wreorder]|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\storeable.h||In instantiation of 'dba::MemberTableBase<T, M>::MemberTableBase(const char*) [with T = dba::StoreTable; M = dba::StoreTableMember]':|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\storeable.h|132|required from here|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\storeable.h|64|warning: 'dba::MemberTableBase<dba::StoreTable, dba::StoreTableMember>::mTableName' will be initialized after [-Wreorder]|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\storeable.h|63|warning:   'int dba::MemberTableBase<dba::StoreTable, dba::StoreTableMember>::mClassOffset' [-Wreorder]|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\storeable.h|602|warning:   when initialized here [-Wreorder]|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\storeable.h||In instantiation of 'dba::MemberTableBase<T, M>::MemberTableBase(const char*) [with T = dba::ColTable; M = dba::ColMemberEntry]':|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\storeable.h|167|required from here|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\storeable.h|64|warning: 'dba::MemberTableBase<dba::ColTable, dba::ColMemberEntry>::mTableName' will be initialized after [-Wreorder]|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\storeable.h|63|warning:   'int dba::MemberTableBase<dba::ColTable, dba::ColMemberEntry>::mClassOffset' [-Wreorder]|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\storeable.h|602|warning:   when initialized here [-Wreorder]|
obj\Debug\CalimeroMain.o||In function `CalimeroFrame::CalimeroFrame(wxWindow*, int)':|
D:\CodeBlocks\Calimero\CalimeroMain.cpp|98|undefined reference to `dba::SQLArchive::SQLArchive(dba::Database*)'|
D:\CodeBlocks\Calimero\CalimeroMain.cpp|103|undefined reference to `dba::SQLArchive::open(char const*, char const*)'|
D:\CodeBlocks\Calimero\CalimeroMain.cpp|110|undefined reference to `dba::SQL::SQL(char const*)'|
D:\CodeBlocks\Calimero\CalimeroMain.cpp|111|undefined reference to `dba::SQLArchive::getIStream()'|
D:\CodeBlocks\Calimero\CalimeroMain.cpp|111|undefined reference to `dba::SQLIStream::sendQuery(dba::SQL const&) const'|
D:\CodeBlocks\Calimero\CalimeroMain.cpp|111|undefined reference to `dba::SQLIStream::~SQLIStream()'|
D:\CodeBlocks\Calimero\CalimeroMain.cpp|110|undefined reference to `dba::SQL::~SQL()'|
D:\CodeBlocks\Calimero\CalimeroMain.cpp|115|undefined reference to `dba::SQLArchive::~SQLArchive()'|
D:\CodeBlocks\Calimero\CalimeroMain.cpp|111|undefined reference to `dba::SQLIStream::~SQLIStream()'|
D:\CodeBlocks\Calimero\CalimeroMain.cpp|110|undefined reference to `dba::SQL::~SQL()'|
D:\CodeBlocks\Calimero\CalimeroMain.cpp|115|undefined reference to `dba::SQLArchive::~SQLArchive()'|
obj\Debug\CalimeroMain.o||In function `dba::SQL& dba::SQL::into<int>(int&)':|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\sql.h|148|undefined reference to `dba::SQL::setFilterDataForNextVar(void*, char const*, char const*, int)'|
obj\Debug\CalimeroMain.o||In function `dba::SQL& dba::SQL::into<std::string>(std::string&)':|
D:\wxWidgets-2.9.4\dba-debug-mono\include\dba\sql.h|148|undefined reference to `dba::SQL::setFilterDataForNextVar(void*, char const*, char const*, int)'|
||=== Build finished: 13 errors, 17 warnings (0 minutes, 9 seconds) ===|
It's very difficult for me to see the problem. I even opened dbad_dll.dll in the dependency walker and found all the functions the linker claims are unreferenced. Now I've the GNU compiler set in C::B, so my last suspect is that it's not able to link the library compiled with nmake, but when I switch to nmake in C::B, I get compile errors in wxWidgets library. I guess I should have everything compiled under the same compiler to have it working, right?

Please is there anybody who has been successful in using the debea DBA library on windows?

Thanks, BR,
Max.
maxbld
Earned some good credits
Earned some good credits
Posts: 113
Joined: Wed Jan 30, 2013 10:49 pm

Re: Can't link DBA library

Post by maxbld »

Hi all,

OK, my guess was right, I only needed the effort to figure out how to fix things. Actually the problem was that the DBA project was configured to use g++, which built a dll that wasn't recognised by the compiler (x86_64-w64-mingw32-g++, the one from TDM-MinGW) I was using in C::B. What is strange is that if I set g++ in C::B it kept not working, but it's probably due to the -m64 option I'm using... Anyway, I'll face this when needed, if ever. :wink:

I tried to query a MySQL database with the ODBC connector and it worked fine and quickly. So under these circumstancies debea library seems good. I'll keep experimenting it and let you know. For the moment let me write a small how-to for Win7 64-bits:

download debea libraries branch_1_4 (find it at http://debea.net/trac/browser/branches/debea_1_4)
Patch the odbc plugin sources for 64-bits environment. You can find it in debea_1_4\dba:
1) odbc.cpp line 232
//SQLINTEGER rowcnt = -1;
SQLLEN rowcnt = -1;
2) odbc.cpp line 408
//SQLINTEGER cb_tablename;
SQLLEN cb_tablename;
3) odbc.h line 96
//long mDataSize;
SQLLEN mDataSize;
Then in debea_1_4
1. copy config_dist.bat to config.bat
2. edit config.bat to suit your needs.
3. run setenv.bat
3. enter folder dba
4. edit makefile.gcc to set CXX = x86_64-w64-mingw32-g++
mingw32-make -f makefile.gcc SQLITE3=0 ODBC=1 SHARED=1 DEBUG=1
mingw32-make -f makefile.gcc SQLITE3=0 ODBC=1 SHARED=1 DEBUG=1 install
Then copy debea_1_4\devel wherever you want to install

(I use SQLITE3=0 because I don't have it onboard)

Hope you enjoy, BR,
Max.
Post Reply