【问题标题】:Qt building OCI pluginQt 构建 OCI 插件
【发布时间】:2012-01-04 09:27:46
【问题描述】:

我正在尝试在 WinXp 上使用 Qt 连接到 Oracle DB。为了按照 Qt 指令使用 QSql,我下载了构建用于 DB 访问的 Qt 插件所必需的源代码(我需要 QOCI)。根据 Qt 文档,我应该运行以下命令:

 set INCLUDE=%INCLUDE%;c:\oracle\oci\include
 set LIB=%LIB%;c:\oracle\oci\lib\msvc
 cd %QTDIR%\src\plugins\sqldrivers\oci
 qmake oci.pro
 nmake

但我收到以下错误:

C:\QtSDK\Desktop\Qt\4.7.4\mingw\src\plugins\sqldrivers\oci>mingw32-make
mingw32-make -f MakeFile.Debug
mingw32-make[1]: Entering directory `C:/QtSDK/Desktop/Qt/4.7.4/mingw/src/plugins/sqldrivers/oci'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_L
IB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\.
.\..\include" -I"..\..\..\..\include\ActiveQt" -I"debug" -I"..\..\..\..\mkspecs\default" -o debug\main.o main.cpp
In file included from main.cpp:44:
../../../sql/drivers/oci/qsql_oci.h:47:46: error: QtSql/private/qsqlcachedresult_p.h: No such file or directory
In file included from main.cpp:44:
../../../sql/drivers/oci/qsql_oci.h:68: error: expected class-name before '{' token
../../../sql/drivers/oci/qsql_oci.h:80: error: 'ValueCache' has not been declared
mingw32-make[1]: *** [debug/main.o] Error 1
mingw32-make[1]: Leaving directory `C:/QtSDK/Desktop/Qt/4.7.4/mingw/src/plugins/sqldrivers/oci'
mingw32-make: *** [debug] Error 2

【问题讨论】:

    标签: database oracle qt qmake oracle-call-interface


    【解决方案1】:

    找不到位于C:\Qt\SDK\Desktop\Qt\4.7.4\mingw\include 的标头。看起来makefile认为它在/sql/drivers/而不是/sqldrivers/。有几种方法可以解决这个问题,我不知道错误是在插件的发布还是Qt移动了它们。

    编辑: 好吧,第一点本身并没有错,但我不认为这是整个故事。使用 Qt Creator 下载时,标头的目录结构与下载为 Qt source 时的目录结构不同。

    我修改后的建议是找到正确的源版本,下载它,然后尝试用它来构建。您必须弄清楚自己应该在层次结构中的哪个位置(因为我以前从未构建过插件),但是在针对源代码构建时应该有更好的运气!

    【讨论】:

    • 当我检查 qsqlcachedresult_p.h 仅位于 C:\QtSDK\QtSources\4.7.4\src\sql\kernel 中。我尝试使用 msvc 进行编译 - 结果相同。
    【解决方案2】:

    我找到了答案。 Oracle 不支持 mingw 编译器,Qt 插件必须使用 msvc 构建。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-05
      • 1970-01-01
      相关资源
      最近更新 更多