您的位置:首页 > 编程语言 > Qt开发

windows下正常编译postgreSQL针对Qt的驱动后的相应设置[原]

2010-06-22 12:31 465 查看
根据Qt助手SQL Database Drivers 章节内容安装postgreSQL 8.4 for windows后,按照Qt官方的文档

How to Build the QPSQL Plugin on Windows

Install the appropriate PostgreSQL developer libraries for your compiler. Assuming that PostgreSQL was installed in C:\psql, build the plugin as follows:

cd %QTDIR%\src\plugins\sqldrivers\psql
qmake "INCLUDEPATH+=C:\psql\include" "LIBS+=C:\psql\lib\ms\libpq.lib" psql.pro
nmake

设置相对应的pgsql的目录,然后直接打开QtCreator打开psql.pro项目编译就成功生成相应的dll (D:\Qt\2010.03\qt\plugins\sqldrivers), 但此时还是不能正常使用该驱动,原因是pgsql的库未加入到PATH里面。

设置好后
QApplication a(argc, argv);
qDebug() << QSqlDatabase::drivers();
return a.exec();

相应的名字为 "QPSQL7","QPSQL"

参考文章 http://www.qtcentre.org/wiki/index.php?title=Building_the_QPSQL_plugin_on_Windows_using_MinGW
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  #Qt