I want to load qt5 psql driver in windows 7.
I've load the library as this way:
qDebug() << QCoreApplication::libraryPaths ();
QString driverName = "QPSQL";
QSqlDatabase::addDatabase(driverName,"A connection to postgres");
And the output shows:
("C:/QT/Qt5.1.0/5.1.0/msvc2010/plugins", "D:/xxx/build-xxx-Desktop_Qt_5_1_0_MSVC2010_32bit-Release/release")
QSqlDatabase: QPSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
And in directory: C:/QT/Qt5.1.0/5.1.0/msvc2010/plugins/
, there does have sqldrivers
subdirectory and qsqlpsql.dll, qsqlpsqld.dll, qsqlpsqld.pdb
in the subdirectory.
I load the psql library successful in ubuntu.
and my .pro file is mainly like this:
QT += core gui sql concurrent
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
unix {
LIBS += -lpython2.7
QMAKE_CXXFLAGS += -std=c++0x
}
win32 {
LIBS += \
C:/Python27/libs/python27.lib
}
I can't find the reason why it failed.
Do I need to add libpqdll.lib in .pro file? But I didn't use LIBS += -lpq
in ubuntu?
BTW: I failed to build libpq in windows 7, using visual studio 2010. But this is another problem.
The question may be easy. But I've tried a wholely day.