Compiling InterBase support in Qt

徘徊边缘 提交于 2019-12-22 01:19:42

问题


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 toisc_sqlcode' C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../../sql/drivers/ibase /qsql_ibase.cpp:85: undefined reference to isc_interprete' debug/qsql_ibase.o:C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../. ./sql/drivers/ibase/qsql_ibase.cpp:406: undefined reference toisc_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 to isc_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 toisc_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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!