0

我正在尝试在 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
4

2 回答 2

1

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

于 2012-01-10T09:42:53.613 回答
1

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

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

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

于 2012-01-04T09:50:44.997 回答