Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPSQL Plugin on Windows
Forum Updated to NodeBB v4.3 + New Features

QPSQL Plugin on Windows

Scheduled Pinned Locked Moved General and Desktop
23 Posts 4 Posters 13.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • TheBadgerT Offline
    TheBadgerT Offline
    TheBadger
    wrote on last edited by
    #9

    [quote author="avpro" date="1370168642"]
    [quote]Search where is libqp-fe.h located and add that path either in INCLUDEPATH in psql.pro or when running qmake[/quote]

    i couldn't find any libqp-fe.h neither in the postgresql directory, nor in QT.

    any suggestion?
    [/quote]

    From what I have seen previously, the developer libraries does not come default with some PostgreSQL installs. If you want to just create an application that uses PostgreSQL I suggest that you download the developer pre-build dlls from PostgreSQL.

    Note the disclaimer on http://www.postgresql.org/download/windows/:
    "Advanced users can also download a "zip archive":http://www.enterprisedb.com/products-services-training/pgbindownload of the binaries, without the installer. This is not recommended for normal installations, it is intended for users who wish to include PostgreSQL as part of another application installer."

    Click on the "zip archive" link above and download the correct archive that you need.

    Also, the path should not contain back slashes (''), you should either escape them (replace '' with '\') or replace them with forward slashes ('/').

    [quote author="avpro" date="1370168642"]i tried
    [quote]qmake "INCLUDEPATH+=$$quote("path to include") ...[/quote]
    but the syntax might be incomplete. one " is missing, the one opened at "INCLUDEPATH...
    [/quote]

    Make sure that you have a quote (") after the command to close the quotes started before the INCLUDEPATH. Something in the line of:

    @qmake "INCLUDEPATH+=$$quote("path to include")"@

    Personally I extarct the binaries into a path without spaces (it helps a lot to simplify things) and then just replace the back- ('') with forward ('/') slashes in your original path, pointing to the extracted lib.

    Hope this helps


    Check out my SpellChecker Plugin for Qt Creator @ https://github.com/CJCombrink/SpellChecker-Plugin

    1 Reply Last reply
    0
    • A Offline
      A Offline
      angelicaP
      wrote on last edited by
      #10

      the libs are not standard installed with psql, but they could be installed if the custom installation option is selected, and than select them.

      i replaced the "" with "/".
      i tried to use the correct command line as described above, and error:

      "can't find .... \include."
      "missing closing parenthesis in function call"
      what's wrong?

      1 Reply Last reply
      0
      • TheBadgerT Offline
        TheBadgerT Offline
        TheBadger
        wrote on last edited by
        #11

        what is the exact command that you executed? Something like the following should work:
        @

        qmake "INCLUDEPATH+=C:/psql/include" "LIBS+=C:/psql/lib/ms/libpq.lib" psql.pro
        @

        Or

        @

        qmake "INCLUDEPATH+=C:\psql\include" "LIBS+=C:\psql\lib\ms\libpq.lib" psql.pro
        @

        I have been using the second one for my PostgreSQL plugin for long now without any problems.


        Check out my SpellChecker Plugin for Qt Creator @ https://github.com/CJCombrink/SpellChecker-Plugin

        1 Reply Last reply
        0
        • A Offline
          A Offline
          angelicaP
          wrote on last edited by
          #12

          thanks for helping me with your precious comments;
          please have a look below on my input and my output:

          C:\Qt\Qt5.0.2\5.0.2>cd src\qtbase\src\plugins\sqldrivers\psql

          C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\src\plugins\sqldrivers\psql>qmake "INCLUDEPATH+=C
          :\program files\postgresql\9.2\include" "LIBS+=C:\program files\postgresql
          \9.2\lib\libpq.lib" psql.pro

          C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\src\plugins\sqldrivers\psql>mingw32-make

          mingw32-make -f Makefile.Release all
          mingw32-make[1]: Entering directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/
          sqldrivers/psql'
          g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++0x -fno-exceptions -frtti -W
          all -Wextra -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCE
          PTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I"C:\program" -
          I"files\postgresql\9.2\include" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include" -I"C:
          \Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtSql" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\in
          clude\QtSql\5.0.2" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtSql\5.0.2\QtSql"
          -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtCore" -I".moc\release_shared" -I"..
          ......\mkspecs\win32-g++" -o .obj\release_shared\qsql_psql.o ......\sql\driv
          ers\psql\qsql_psql.cpp
          ......\sql\drivers\psql\qsql_psql.cpp:58:22: fatal error: libpq-fe.h: No such
          file or directory
          compilation terminated.
          Makefile.Release:483: recipe for target '.obj/release_shared/qsql_psql.o' failed

          mingw32-make[1]: *** [.obj/release_shared/qsql_psql.o] Error 1
          mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/s
          qldrivers/psql'
          makefile:38: recipe for target 'release-all' failed
          mingw32-make: *** [release-all] Error 2

          C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\src\plugins\sqldrivers\psql>

          i think this is not much different from my previous post. SGaist suggested:
          "Search where is libqp-fe.h located and add that path either in INCLUDEPATH in psql.pro or when running qmake"

          and i said that "i couldn’t find any libqp-fe.h neither in the postgresql directory, nor in QT. "
          i don't have this file.

          i think worth to mentioned is the path ....C:\psql\lib\ms\libpq.lib" psql.pro. this folder "ms" is missing. the file libpq.lib is located directly in folder "lib". so i skipped this folder in my command.

          any idea how to continue, and install this psql driver for QT?
          thanks for your input.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #13

            If possible, reinstall postgresql in a path without spaces, that will make you life easier. Otherwise you have to give the old 8.3 name to avoid the space problem.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • TheBadgerT Offline
              TheBadgerT Offline
              TheBadger
              wrote on last edited by
              #14

              Here is your problem:
              [quote author="avpro" date="1370459887"]
              C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\src\plugins\sqldrivers\psql>qmake "INCLUDEPATH+=C
              :\program files\postgresql\9.2\include" "LIBS+=C:\program files\postgresql
              \9.2\lib\libpq.lib" psql.pro
              ...

              -I"C:\program" -I"files\postgresql\9.2\include"

              [/quote]
              Because there is spaces in the path to your PostgreSQL install and you did not escape it properly (a user commented on how to handle spaces) the compiler splits your include path at the space and include the above 2 paths, instead of the one that you wanted.

              So the solution is to either use this comment (read up on the "$$quote()":http://qt-project.org/doc/qt-4.8/qmake-function-reference.html#quote-string command):
              [quote author="Hostel" date="1370131524"]You have a spaces in includepath to pg(Program Files for example). From command line try this:
              @
              qmake "INCLUDEPATH+=$$quote("path to include") ...
              @
              [/quote]

              Or the one that I would follow, and the easiest one for future:

              [quote author="SGaist" date="1370460739"]If possible, reinstall postgresql in a path without spaces, that will make you life easier. Otherwise you have to give the old 8.3 name to avoid the space problem.[/quote]


              Check out my SpellChecker Plugin for Qt Creator @ https://github.com/CJCombrink/SpellChecker-Plugin

              1 Reply Last reply
              0
              • A Offline
                A Offline
                angelicaP
                wrote on last edited by
                #15

                I come back with more details:

                bq.
                If possible, reinstall postgresql in a path without spaces, that will make you life easier. Otherwise you have to give the old 8.3 name to avoid the space problem.

                I reinstalled Posgresql in a folder without spaces.

                i run the qmake command once again, and after the mingw32-make.
                this is what it resulted:

                C:\Qt\Qt5.0.2\5.0.2>cd src\qtbase\src\plugins\sqldrivers\psql

                C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\src\plugins\sqldrivers\psql>qmake "INCLUDEPATH+=c
                :\postgresql\9.2\include" "LIBS+=c:\postgresql\9.2\lib\libpq.lib" psql.pro

                C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\src\plugins\sqldrivers\psql>mingw32-make
                mingw32-make -f Makefile.Release all
                mingw32-make[1]: Entering directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/
                sqldrivers/psql'
                g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++0x -fno-exceptions -frtti -W
                all -Wextra -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCE
                PTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I"C:\postgresql
                \9.2\include" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include" -I"C:\Qt\Qt5.0.2\5.0.2
                mingw47_32\include\QtSql" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtSql\5.0.2"
                -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtSql\5.0.2\QtSql" -I"C:\Qt\Qt5.0.2\5
                .0.2\mingw47_32\include\QtCore" -I".moc\release_shared" -I"........\mkspecs\w
                in32-g++" -o .obj\release_shared\qsql_psql.o ......\sql\drivers\psql\qsql_psql
                .cpp
                In file included from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/i686-w64-mingw32/bits/gthr-default.h:41:0,
                from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/i686-w64-mingw32/bits/gthr.h:150,
                from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/ext/atomicity.h:34,
                from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/bits/basic_string.h:41,
                from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/string:54,
                from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/random:41,
                from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/bits/stl_algo.h:67,
                from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/algorithm:63,
                from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qglobal.h:80
                ,
                from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qatomic.h:42
                ,
                from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qvariant.h:4
                5,
                from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtSql/qsqlresult.h:
                45,
                from ......\sql\drivers\psql\qsql_psql.h:45,
                from ......\sql\drivers\psql\qsql_psql.cpp:42:
                C:\postgresql\9.2\include/pthread.h:307:8: error: redefinition of 'struct timesp
                ec'
                In file included from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/../../../../i686-w64-mingw32/include/time.h:277:0,
                from C:\postgresql\9.2\include/pthread.h:218,
                from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/i686-w64-mingw32/bits/gthr-default.h:41,
                from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/i686-w64-mingw32/bits/gthr.h:150,
                from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/ext/atomicity.h:34,
                from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/bits/basic_string.h:41,
                from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/string:54,
                from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/random:41,
                from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/bits/stl_algo.h:67,
                from c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/
                4.7.2/include/c++/algorithm:63,
                from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qglobal.h:80
                ,
                from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qatomic.h:42
                ,
                from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qvariant.h:4
                5,
                from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtSql/qsqlresult.h:
                45,
                from ......\sql\drivers\psql\qsql_psql.h:45,
                from ......\sql\drivers\psql\qsql_psql.cpp:42:
                c:\qt\qt5.0.2\tools\mingw\bin../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686
                -w64-mingw32/include/sys/timeb.h:90:8: error: previous definition of 'struct tim
                espec'
                Makefile.Release:486: recipe for target '.obj/release_shared/qsql_psql.o' failed

                mingw32-make[1]: *** [.obj/release_shared/qsql_psql.o] Error 1
                mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/s
                qldrivers/psql'
                makefile:38: recipe for target 'release-all' failed
                mingw32-make: *** [release-all] Error 2

                C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\src\plugins\sqldrivers\psql>

                the error is: error: previous definition of 'struct timespec'

                any idea how this could be resolved?

                i found "here":https://bugreports.qt-project.org/browse/QTBUG-9032?actionOrder=desc this report, but i think is for linux.
                any experience how to step over this error?

                thank you all.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  angelicaP
                  wrote on last edited by
                  #16

                  hi,

                  i would like to restart the thread. in this moment i'm in the following point:

                  1. i reinstalled PostgreSQL in "C:\psql" to avoid any problems which might come up if Postgresql is installed in "space" separated path, like "C:\Program Files".
                  2. i copied libpq-fe.h, pg_config.h and postgres_ext.h from "c:\psql\include" to "C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\src\plugins\sqldrivers\psql"
                  3. i followed the procedure described "here":http://qt-project.org/doc/qt-4.8/sql-driver.html#qpsql to create the QPSQL plugin
                  4. i replaced "nmake" with "mingw32-make" because i have the MinGw compiler.

                  Note: the commands are run from Qt's command line prepared by Qt installer.

                  this is the output:

                  C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\src\plugins\sqldrivers\psql>mingw32-make
                  mingw32-make
                  -f Makefile.Release all
                  mingw32-make[1]:
                  Entering directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/
                  sqldrivers/psql'
                  g++ -Wl,-s
                  -shared -Wl,--out-implib,C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\plugins\sqldr
                  ivers\libqsqlpsql.a
                  -o ........\plugins\sqldrivers\qsqlpsql.dll .obj/release_
                  shared/main.o
                  .obj/release_shared/qsql_psql.o .obj/release_shared/moc_qsql_psql.
                  o -lpq -LC:\Qt\Qt5.0.2\5.0.2\mingw47_32\lib
                  -lQt5Sql -lQt5Core
                  c:/qt/qt5.0.2/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686
                  -w64-mingw32/bin/ld.exe:
                  cannot find -lpq
                  collect2.exe:
                  error: ld returned 1 exit status
                  Makefile.Release:80:
                  recipe for target '........\plugins\sqldrivers\qsqlpsql.
                  dll' failed
                  mingw32-make[1]:
                  [........\plugins\sqldrivers\qsqlpsql.dll] Error 1
                  mingw32-make[1]:
                  Leaving directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/s
                  qldrivers/psql'
                  makefile:38:
                  recipe for target 'release-all' failed
                  mingw32-make:
                  [release-all] Error 2

                  any idea what is wrong?
                  thank you.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #17

                    Did you put somewhere the path to libpq ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      angelicaP
                      wrote on last edited by
                      #18

                      you mean if I set up the user Environmental Variables?
                      yes, i did that too, for c:\psql\lib

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        angelicaP
                        wrote on last edited by
                        #19

                        are you referring to your previous post
                        bq. Search where is libqp-fe.h located and add that path either in INCLUDEPATH in psql.pro or when running qmake

                        sorry, i'm not sure if i understand correctly: bq. Did you put somewhere the path to libpq ?
                        could you please try once again?
                        thanks.

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #20

                          Sorry,
                          Did you also do something like:
                          @LIBS+=-LC:/psql/folder_where_libqp_can_be_found@

                          in your pro file ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            angelicaP
                            wrote on last edited by
                            #21

                            not yet, but i will give a try

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              angelicaP
                              wrote on last edited by
                              #22

                              i integrated the LIBS+=-LC:/psql/folder_where_libqp_can_be_found
                              in my psql.pro file like this:

                              TARGET = qsqlpsql

                              SOURCES = main.cpp
                              OTHER_FILES += psql.json
                              include(../../../sql/drivers/psql/qsql_psql.pri)

                              PLUGIN_CLASS_NAME = QPSQLDriverPlugin
                              include(../qsqldriverbase.pri)
                              LIBS+=-LC:/psql/lib

                              and got this output, surprisingly without errors; but the "driver not loaded" error still comes as soon as I test with
                              @qDebug() << "Error = " << db.lastError().text();@

                              C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\src\plugins\sqldrivers\psql>mingw32-make
                              C:\Qt\Qt5.0.2\5.0.2\mingw47_32\bin\qmake.exe "INCLUDEPATH+=C:\psql\includeö ôL
                              IBS+=c:\psql\lib\libpq.libö psql.pro" -o Makefile psql.pro
                              mingw32-make -f Makefile.Release all
                              mingw32-make[1]: Entering directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/
                              sqldrivers/psql'
                              g++ -Wl,-s -shared -Wl,--out-implib,C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\plugins\sqldr
                              ivers\libqsqlpsql.a -o ........\plugins\sqldrivers\qsqlpsql.dll .obj/release_
                              shared/main.o .obj/release_shared/qsql_psql.o .obj/release_shared/moc_qsql_psql.
                              o -Lc:\psql\lib -lpq -LC:/psql/lib -LC:\Qt\Qt5.0.2\5.0.2\mingw47_32\lib -lQt5Sq
                              l -lQt5Core
                              mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/s
                              qldrivers/psql'
                              mingw32-make -f Makefile.Debug all
                              mingw32-make[1]: Entering directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/
                              sqldrivers/psql'
                              g++ -c -pipe -fno-keep-inline-dllexport -g -std=c++0x -fno-exceptions -frtti -Wa
                              ll -Wextra -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEP
                              TIONS -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I"C:\psql\includeö" -I"ôLIBS+=
                              c:\psql\lib\libpq.libö" -I"psql.pro" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include"
                              -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtSql" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_
                              32\include\QtSql\5.0.2" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtSql\5.0.2\Qt
                              Sql" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtCore" -I".moc\debug_shared" -I"
                              ........\mkspecs\win32-g++" -o .obj\debug_shared\qsql_psql.o ......\sql\dri
                              vers\psql\qsql_psql.cpp
                              cc1plus.exe: warning: psql.pro: not a directory [enabled by default]
                              C:\Qt\Qt5.0.2\5.0.2\mingw47_32\bin\moc.exe -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_
                              NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I.
                              -I"C:\psql\includeö" -I"ôLIBS+=c:\psql\lib\libpq.libö" -I"psql.pro" -I"C:\Qt\Qt
                              5.0.2\5.0.2\mingw47_32\include" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtSql"
                              -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtSql\5.0.2" -I"C:\Qt\Qt5.0.2\5.0.2\m
                              ingw47_32\include\QtSql\5.0.2\QtSql" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\Q
                              tCore" -I".moc\debug_shared" -I"........\mkspecs\win32-g++" -D__GNUC__ -DWIN3
                              2 ......\sql\drivers\psql\qsql_psql.h -o .moc\debug_shared\moc_qsql_psql.cpp
                              g++ -c -pipe -fno-keep-inline-dllexport -g -std=c++0x -fno-exceptions -frtti -Wa
                              ll -Wextra -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEP
                              TIONS -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I"C:\psql\includeö" -I"ôLIBS+=
                              c:\psql\lib\libpq.libö" -I"psql.pro" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include"
                              -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtSql" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_
                              32\include\QtSql\5.0.2" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtSql\5.0.2\Qt
                              Sql" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtCore" -I".moc\debug_shared" -I"
                              ........\mkspecs\win32-g++" -o .obj\debug_shared\moc_qsql_psql.o .moc\debug_s
                              hared\moc_qsql_psql.cpp
                              cc1plus.exe: warning: psql.pro: not a directory [enabled by default]
                              g++ -shared -Wl,--out-implib,C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\plugins\sqldrivers\l
                              ibqsqlpsqld.a -o ........\plugins\sqldrivers\qsqlpsqld.dll .obj/debug_shared/
                              main.o .obj/debug_shared/qsql_psql.o .obj/debug_shared/moc_qsql_psql.o -Lc:\psq
                              l\lib -lpq -LC:/psql/lib -LC:\Qt\Qt5.0.2\5.0.2\mingw47_32\lib -lQt5Sqld -lQt5Cor
                              ed
                              mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/s
                              qldrivers/psql'

                              after that i put the LIBS+=-LC:/psql/folder_where_libqp_can_be_found
                              in my psql.pro file like this:

                              TARGET = qsqlpsql

                              SOURCES = main.cpp
                              OTHER_FILES += psql.json
                              include(../../../sql/drivers/psql/qsql_psql.pri)
                              LIBS+=-LC:/psql/lib

                              PLUGIN_CLASS_NAME = QPSQLDriverPlugin
                              include(../qsqldriverbase.pri)

                              and got this output,

                              C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\src\plugins\sqldrivers\psql>mingw32-make
                              C:\Qt\Qt5.0.2\5.0.2\mingw47_32\bin\qmake.exe "INCLUDEPATH+=C:\psql\includeö ôL
                              IBS+=c:\psql\lib\libpq.libö psql.pro" -o Makefile psql.pro
                              mingw32-make -f Makefile.Release all
                              mingw32-make[1]: Entering directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/
                              sqldrivers/psql'
                              mingw32-make[1]: Nothing to be done for 'all'.
                              mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/s
                              qldrivers/psql'
                              mingw32-make -f Makefile.Debug all
                              mingw32-make[1]: Entering directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/
                              sqldrivers/psql'
                              mingw32-make[1]: Nothing to be done for 'all'.
                              mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/s
                              qldrivers/psql'

                              but the "driver not loaded" error still comes as soon as I test with
                              @qDebug() << "Error = " << db.lastError().text();@

                              1. which is the correct output?
                              2. i think i should obtain the qsqlpsql.dll file after this is correctly created, which should be copied to c:[Qt]\mingw47_32\plugins\sqldrivers\

                              what's wrong?
                              thanks for your input

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #23

                                I don't know if it's the copy/paste or something else, but you are having a lot of strange char in your mignw32-make output.

                                And this line:
                                @cc1plus.exe: warning: psql.pro: not a directory [enabled by default]@

                                looks suspicious

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved