Win7下编译Qt5.4OCI驱动

打开Qt 5.4 for Desktop (MinGW 4.9 32 bit)

输入  set INCLUDE=%include%;E:\app\lyg\product\11.2.0\dbhome_1\OCI\include;F:\QtIDE\Tools\mingw491_32\include

输入  set LIB=%lib%;E:\app\lyg\product\11.2.0\dbhome_1\OCI\lib\MSVC

输入  cd F:\QtIDE\5.4\Src\qtbase\src\plugins\sqldrivers\oci

输入  qmake oci.pro

输入  mingw32-make             

(以上E:,F:开头要改成你自己的安装路径)


mingw32-make 之后输出4个文件,输出到:F:\QtIDE\5.4\Src\qtbase\plugins\sqldrivers

libqsqloci.a,libqsqlocid.a,qsqloci.dll,qsqlocid.dll


将其复制到:“F:\QtIDE\5.4\mingw491_32\plugins\sqldrivers”即可


用Qt新建工程,添加一下代码

#include<QSqlDriver>
#include<QSqlDatabase>
#include<QDebug>

qDebug()<<"Available drivers:";  
QStringList drivers=QSqlDatabase::drivers();  
foreach(QString driver,drivers)    
qDebug()<<driver;


你可能感兴趣的:(win7,qt,OCI驱动)