Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QT QPSQL compile driver MSVC 2019 64

QT QPSQL compile driver MSVC 2019 64

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
14 Posts 2 Posters 1.5k Views
  • 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.
  • T Offline
    T Offline
    tomsmith
    wrote on last edited by
    #1

    Good afternoon!
    I want to compile the Postgresql driver for Qt5.15.2 MSVC 2019 64, as a result, I don't want to compile, although everything compiles perfectly under MinGW 8.1.0 64. Before reinstalling Windows, everything worked and compiled.

    here is a screenshot of the compilation
    QPsql Driver Compilation

    alt text

    the difference in .qmake.stash

    alt text

    an error also falls in the nmake log:

    looking for library psql
    Trying source 0 (type pkgConfig) of library psql ...
    pkg-config use disabled globally.
      => source produced no result.
    Trying source 1 (type psqlConfig) of library psql ...
    pg_config not found.
      => source produced no result.
    Trying source 2 (type psqlEnv) of library psql ...
    + cd /d C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers\config.tests\psql && C:\Qt\5.15.2\msvc2019_64\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.7.25-winx64\\include C:\\Utils\\postgresql\\pgsql\\include" "QMAKE_USE += psql" "QMAKE_LIBS_PSQL = -LC:\\psql\\lib -llibpq -lws2_32 -ladvapi32" "QMAKE_INCDIR_PSQL = C:\\psql\\include" C:/Qt/5.15.2/Src/qtbase/src/plugins/sqldrivers/config.tests/psql
    + cd /d C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers\config.tests\psql && set MAKEFLAGS=& nmake clean && set MAKEFLAGS=& nmake
    > Microsoft (R) Program Maintenance Utility Version 14.29.30136.0
    > Copyright (C) Microsoft Corporation.  All rights reserved.
    > 	del main.obj
    > ЌҐ г¤ Ґвбп ­ ©вЁ C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers\config.tests\psql\main.obj
    > Microsoft (R) Program Maintenance Utility Version 14.29.30136.0
    > Copyright (C) Microsoft Corporation.  All rights reserved.
    > 	cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W0 -EHsc -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DNDEBUG -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.7.25-winx64\include -IC:\Utils\postgresql\pgsql\include -IC:\psql\include -IC:\Qt\5.15.2\msvc2019_64\mkspecs\win32-msvc -Fo @C:\Users\tomes\AppData\Local\Temp\nmA14B.tmp
    > main.cpp
    > C:\psql\include\libpq-fe.h(23): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
    > NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.EXE"' : return code '0x2'
    > Stop.
     => source failed verification.
    Trying source 3 (type psqlEnv) of library psql ...
      => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.psql FAILED
    looking for library sqlite2
    

    how to overcome this attack ? I don't understand much in the settings. I understand that it is necessary to make the configuration. only how? and where?
    why is it compiled under mingw, but does not want to under MSVC.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @tomsmith said in QT QPSQL compile driver MSVC 2019 64:

      Cannot open include file: 'stdio.h': No such file or directory

      Fix you MSVC installation, make sure you used the correct MSVC command line.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tomsmith
        wrote on last edited by
        #3

        Thanks for the answer
        Do you mean that you need to reinstall MSVC? I have a question why, when compiling with MSVC, there are no paths in the qmake.stash file, as it is for Mingw.

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          No reinstallation of MSVC needed, just have to make sure your current console is able to compile a simple main.cpp which includes stdio.h.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tomsmith
            wrote on last edited by
            #5

            everything is compiled in visual studio, everything is compiled in visual studio. I think that it is necessary to indicate somewhere the paths to C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\SDK\scopecppsdk\vc15\SDK\include\ucrt stdio.h is located here

            Christian EhrlicherC 1 Reply Last reply
            0
            • T tomsmith

              everything is compiled in visual studio, everything is compiled in visual studio. I think that it is necessary to indicate somewhere the paths to C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\SDK\scopecppsdk\vc15\SDK\include\ucrt stdio.h is located here

              Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by Christian Ehrlicher
              #6

              And that's done when you open a MSVC developer command prompt... so make sure you properly open it and a simple main.cpp as explained above can be compiled from there.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              1
              • T Offline
                T Offline
                tomsmith
                wrote on last edited by
                #7

                alt text
                everything is compiled from the command line

                1 Reply Last reply
                0
                • Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  So when there is an include of stdio.h then you should also be able to compile the qt sql driver there.

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    tomsmith
                    wrote on last edited by
                    #9

                    Thanks for the help compiled into the Command Line of native x64 tools for VS 2019. another question is how to add a driver to the project? and where is it located?

                    Christian EhrlicherC 1 Reply Last reply
                    0
                    • T tomsmith

                      Thanks for the help compiled into the Command Line of native x64 tools for VS 2019. another question is how to add a driver to the project? and where is it located?

                      Christian EhrlicherC Offline
                      Christian EhrlicherC Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @tomsmith said in QT QPSQL compile driver MSVC 2019 64:

                      how to add a driver to the project?

                      Simply load it like any other Qt Sql driver: https://doc.qt.io/qt-5/qsqldatabase.html#details

                      and where is it located?

                      It must be under <QTDIR>/plugins/sqldrivers

                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                      Visit the Qt Academy at https://academy.qt.io/catalog

                      1 Reply Last reply
                      1
                      • T Offline
                        T Offline
                        tomsmith
                        wrote on last edited by
                        #11

                        in my project I use Qt 5.15.2 (MSVC 2019 64) but the same error fatal error C1034: stdio.h: no include path set is not compiled under it. How to configure?
                        alt text

                        1 Reply Last reply
                        0
                        • Christian EhrlicherC Offline
                          Christian EhrlicherC Offline
                          Christian Ehrlicher
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @tomsmith said in QT QPSQL compile driver MSVC 2019 64:

                          How to configure?

                          As explained above - open the MSVC developer command prompt as @tomsmith did...

                          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                          Visit the Qt Academy at https://academy.qt.io/catalog

                          1 Reply Last reply
                          0
                          • T Offline
                            T Offline
                            tomsmith
                            wrote on last edited by
                            #13

                            everything is solved everything works in the folder C:\Qt\5.15.2\msvc2019_64\bin I threw it libpq.dll and qsqlpsqld.dll

                            when compiling the driver from the Qt 5.15.2 window (MSVC2019 64), it was necessary to run C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat then compilation is performed without errors.

                            Thanks for the help.

                            1 Reply Last reply
                            0
                            • Christian EhrlicherC Offline
                              Christian EhrlicherC Offline
                              Christian Ehrlicher
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @tomsmith said in QT QPSQL compile driver MSVC 2019 64:

                              t was necessary to run C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat then compilation is performed without errors.

                              This is what I told you ...

                              open the MSVC developer command prompt

                              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                              Visit the Qt Academy at https://academy.qt.io/catalog

                              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