问题
I have followed the instructions on http://doc.qt.nokia.com/stable/sql-driver.html#qibase for compiling Interbase support into Qt, and made sure all of my libraries are in the right place. qmake runs successfully, but when I run nmake, I get a series of undefined reference errors in qsql_ibase.cpp. If I open up the .pro in Qt Creator and hover over one of the functions that is throwing the undefined reference errors and follow the symbol (F2), it takes me to the ibase.h file where it is declared. Is it throwing the undefined reference errors because there is no function definition? If that is the case, why isn't it giving me any errors about a missing library?
Output example:
Creating library file: debug\libqsqlibased4.a debug/qsql_ibase.o: In function
getIBaseError': C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../../sql/drivers/ibase /qsql_ibase.cpp:80: undefined reference to
isc_sqlcode' C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../../sql/drivers/ibase /qsql_ibase.cpp:85: undefined reference toisc_interprete' debug/qsql_ibase.o:C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../. ./sql/drivers/ibase/qsql_ibase.cpp:406: undefined reference to
isc_dsql_free_st atement' debug/qsql_ibase.o:C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../. ./sql/drivers/ibase/qsql_ibase.cpp:421: undefined reference toisc_create_blob2 ' debug/qsql_ibase.o:C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../. ./sql/drivers/ibase/qsql_ibase.cpp:427: undefined reference to
isc_put_segment'
This continues for many more errors, all undefined references.
回答1:
That really sounds like the first issue mentioned under the "Troubleshooting" section of the page to which you link above:
You should always use client libraries that have been compiled with the same compiler as you are using for your project. If you cannot get a source distibution to compile the client libraries yourself, you must make sure that the pre-compiled library is compatible with your compiler, otherwise you will get a lot of "undefined symbols" errors. Some compilers have tools to convert libraries, e.g. Borland ships the tool COFF2OMF.EXE to convert libraries that have been generated with Microsoft Visual C++.
Which compiler are you using to compile Qt, and where did you get the Interbase libraries? You also need to make sure those libraries can be found at link time. If you look at the output of your compiler, it should show you all the link directories in which it is searching (in addition to any globally defined, like PATH in Windows.) If the folder with your Interbase library is listed, it is probably that the compiler versions aren't matching.
回答2:
Sorry for raising so old theme, but I found a solution and want to share with it. The problem is that macro ISC_EXPORT
was not defined in Interbase's SDK due to conditional compilation defines. See details here - Howto build Interbase plugin for Qt by MinGW
来源:https://stackoverflow.com/questions/8038649/compiling-interbase-support-in-qt