Qt默认是不编译postgre驱动的,你需要自己进行编译。
1.首先安装postgrel,可以去http://www.postgresql.org/下载最新的版本,安装完毕以后把postgre的bin路径加到PATH路径上去
2.Qt编译postgre
1) linux版本
cd $QTDIR/src/plugins/sqldrivers/psql
qmake "INCLUDEPATH+=/usr/include/pgsql" "LIBS+=-L/usr/lib -lpq" psql.pro
make
2)window版本
cd %QTDIR%/src/plugins/sqldrivers/psql
qmake "INCLUDEPATH+='C:/psql/include'" "LIBS+='C:/psql/lib/ms/libpq.lib' " psql.pro
nmake
这样就编译好了
本文详细介绍如何在Qt中手动编译PostgreSQL数据库驱动。包括安装PostgreSQL,并配置其bin路径,以及在Linux和Windows环境下具体的编译步骤。
1809

被折叠的 条评论
为什么被折叠?



