问题描述
我的应用程序通过Qt的QSqlDatabase类访问Oracle数据库。
我正在编译Qt作为发布版本的静态,但我似乎不能以摆脱OCI.dll依赖。
这是我的配置行:
配置-qt-libjpeg -qt-zlib -qt-libpng -nomake示例-nomake demos -no-exceptions -no-stl - no-rtti -no-qt3support -no-scripttools -no-openssl -no-opengl -no-phonon -no-style-motif -no-style-cde -no-style-cleanlooks -no-style-plastique -static - release -opensource -plugin-sql-oci -plugin-sql-sqlite -platform win32-msvc2005
I使用以下链接在SDK的文件夹中链接oci.h和oci.lib:
设置INCLUDE = C:\oracle\ instantclient \sdk\include;%INCLUDE%
set LIB = C:\oracle\instantclient\sdk\lib\msvc;%LIB%
然后,一旦编译Qt,我在我的* .pro文件中使用以下行:
QT + = sql
CONFIG + = static
LIBS + = C:\oracle\instantclient\sdk\lib\msvc\oci .lib
QTPLUGIN + = qsqloci
然后,在我的 main.cpp ,我添加以下命令在应用程序中静态编译OCI插件:
#include< QtPlugin&
Q_IMPORT_PLUGIN(qsqloci)
编译项目后,我的工作站和它的工作原理(因为我安装了Oracle Instant Client)。当我尝试在另一个工作站,我总是得到的消息:
我不明白为什么我还需要OCI.dll,因为我的静态链接的应用程序应该链接到oci.lib。
有没有Qt人在这里可能有我的解决方案?
非常感谢!
STL
解决方案链接的.lib文件不是你认为的。它是DLL的导入库,链接器需要它,所以它知道oci.dll实现什么函数。我没有看到从Oracle可用的库的静态版本,但没有看起来太难。这是非常典型的dbase接口。
您需要按照oci.dll的部署说明,OCI即时客户端安装过程在。改变PATH,哦快乐。
My application accesses an Oracle database through Qt's QSqlDatabase class.
I'm compiling Qt as static for the release build, but I can't seem to be able to get rid of OCI.dll dependency. I'm trying to link against oci.lib (as available in Oracle's Instant Client with SDK).
Here's my configure line :
configure -qt-libjpeg -qt-zlib -qt-libpng -nomake examples -nomake demos -no-exceptions -no-stl -no-rtti -no-qt3support -no-scripttools -no-openssl -no-opengl -no-phonon -no-style-motif -no-style-cde -no-style-cleanlooks -no-style-plastique -static -release -opensource -plugin-sql-oci -plugin-sql-sqlite -platform win32-msvc2005
I link against oci.h and oci.lib in the SDK's folder by using :
set INCLUDE=C:\oracle\instantclient\sdk\include;%INCLUDE% set LIB=C:\oracle\instantclient\sdk\lib\msvc;%LIB%
Then, once Qt is compiled, I use the following lines in my *.pro file :
QT += sql CONFIG += static LIBS += C:\oracle\instantclient\sdk\lib\msvc\oci.lib QTPLUGIN += qsqloci
Then, in my main.cpp, I add the following commands to statically compile OCI plugin in the application :
#include <QtPlugin> Q_IMPORT_PLUGIN(qsqloci)
After compiling the project, I test it on my workstation and it works (as I have Oracle Instant Client installed). When I try on another workstation, I always get the message:
I don't understand why I still need OCI.dll, as my statically linked application is supposed to link to oci.lib instead.
Is there any Qt people here that might have a solution for me ?
Thanks a lot !
STL
解决方案The .lib file you linked is not what you think it is. It is the import library for the DLL, the linker needs it so it knows what functions are implemented by oci.dll. I don't see a static version of the library available from Oracle but didn't look too hard. That's pretty typical for dbase interfaces.
You'll need to follow the deployment instructions for oci.dll, "OCI Instant Client Installation Process" in this document. Changing the PATH, oh joy.
这篇关于如何摆脱OCI.dll依赖在编译静态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!