QPSQL driver not loaded Qt

后端 未结 4 2006
[愿得一人]
[愿得一人] 2020-11-30 14:10

I have some trouble when I want to add a database.

    _dataBase = QSqlDatabase::addDatabase(\"QPSQL\");

After calling this method I have

4条回答
  •  执笔经年
    2020-11-30 14:46

    I came here googling because I had the same problem in Windows.

    In my case to solve the issue I had to install PostgreSQL for Windows 32 bits since my Qt target was MinGW 32 bits.

    Additionally, I had to add the PATH to the PostgreSQL bin and lib directories so Qt could find the right .dlls.

    @SET PATH=C:\Program Files (x86)\PostgreSQL\9.6\bin\;C:\Program Files (x86)\PostgreSQL\9.6\lib\;%PATH%
    

    The PATH can be set before launching Qt Creator or using the Qt Creator itself via the Build Environment in the Projects pane.

提交回复
热议问题