Qt5.8.0 mingw 编译QOCI

来源:互联网 发布:js 数组初始化0 编辑:程序博客网 时间:2024/05/18 15:06

从oracle官网下载oracle 12g 驱动
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
分别下载 instantclient-sdk-nt-12.2.0.1.0.zip和instantclient-basic-nt-12.2.0.1.0.zip
然后解压文件。将解压出来的文件拷贝到指定目录。如本人及其:C:\instantclient_12_2_x86

进入C:\Qt\Qt5.8.0\5.8\Src\qtbase\src\plugins\sqldrivers\oci 直接编译: Library ‘oci’ is not defined.
如果用的是mingw版本,修改如下:

QMAKE_LFLAGS += C:\instantclient_12_2_x86\oci.dll

也可以将C:\instantclient_12_2_x86添加到环境变量path中,就可以不指定路径

QMAKE_LFLAGS += oci.dll

如果使用的是MSVC版本修改

QMAKE_LFLAGS += oci.lib

然后添加

INCLUDEPATH +=C:\instantclient_12_2_x86\sdk\includeLIBPATH +=C:\instantclient_12_2_x86\sdk\lib\msvc

最后执行清理->构建 正常情况下就可以在 Qt安装的根目录的plugins\sqldrivers找到编译好的动态库,再将编译好的动态库拷贝到
C:\Qt\Qt5.8.0\5.8\mingw53_32\plugins\sqldrivers

参考:https://www.cnblogs.com/CLXiao-1029/p/7368497.html

原创粉丝点击