QT – PostgreSQL plugin error

I have an app, that should connect to database.
Under linux i’ve no problems, but under windows – > i’ve to add to system “Path” place, where QT enviroment is placed (C:/QT/Tools/QTCreator/bin) otherwise it doesn’t work and shows errors like below.
id doesn’t work if i place exe file on pendrive too

i would like to send this app to my firends, who shouldn’t install QT environment and just run this app.

dirs on my pendrive

/
app.exe
plugins (dir)
-qsqlpsql.dll
-sqldrivers (dir)
–qsqlpsql.dll

what should i do? where did i mistake?

pro file:

QT       += core gui sql

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = NZP
TEMPLATE = app


SOURCES += main.cpp
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui
win32{
LIBS += -L"C:/Program Files/psqlODBC/0903/bin"
}
RC_FILE += Info.rc

in my main.cpp:

QApplication a(argc, argv);
   qDebug()<<QCoreApplication::applicationDirPath();
   a.addLibraryPath(QCoreApplication::applicationDirPath());
   a.addLibraryPath(QCoreApplication::applicationDirPath()+"/plugins");
   qDebug()<<a.libraryPaths();

    MainWindow w;
    w.show();

    return a.exec(); 

if i run this app under windows, where i installed QT – everythink is correct, but if i move it on pendrive or run under machine without QT framework – i become error:

QSqlDatabase: QPSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC QPSQL QPSQL7

Failed to open database connection. Invalid driver specfied.

i have looked in internet, but by now without sensible solution
help!


Source: windows

Leave a Reply