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. Build failed with MSVC2017-64bit but works fine with MSVC2017-32bit
QtWS25 Last Chance

Build failed with MSVC2017-64bit but works fine with MSVC2017-32bit

Scheduled Pinned Locked Moved Solved Installation and Deployment
13 Posts 4 Posters 1.0k 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.
  • M.H.HM Offline
    M.H.HM Offline
    M.H.H
    wrote on last edited by
    #1

    Hi there,

    I am using Qt Creator 4.13.1 on Windows 10 and the Qt version is 5.12.1.
    The code is built successfully with MinGW-64bit and MSVC2017-32bit. But when I use MSVC2017-64bit a lot of errors reports by the compiler.
    All the errors are about the Qt source code and classes.

    Is there anyone who knows how I can fix it.

    1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher

      You must have mixed up your includes. Maybe the msvc compiler option '/showIncludes' helps you to find out what's going wrong.
      Also 'member function already defined or declared' should print out a filename where the previous definition is.

      M.H.HM Offline
      M.H.HM Offline
      M.H.H
      wrote on last edited by M.H.H
      #7

      @Christian-Ehrlicher Thanks for your mention. I compared the qvariant.h file in 32-bit MSVC with 64-bit MSVC versions. I found out that QRect was replicated in the 64-bit version. I changed it to QRectF and then it works. But, some other errors arose.
      So, I replaced the include folder of 64-bit with 32-bit one. One project works fine and another one has some errors. I think I require to re-install MSVC-64bit again.

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

        Hi,

        Might be a silly question but did you install the corresponding 64 bit Qt build ?

        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
        • M.H.HM Offline
          M.H.HM Offline
          M.H.H
          wrote on last edited by M.H.H
          #3

          In fact, inside the Qt 3 SDKs are installed :

          • MinGW7.3 64bit
          • MSVC2017 32bit
          • MSVC2017 64bit*

          Qt detects and shows all of them on the "Kits" and "Qt Versions" tabs of Qt creator options. So, I can switch between those SDKs. The only problem is that when I config a project for using MSVC2017-64bit it does not work.

          I uploaded a screenshot of errors. it might help.

          qt-error-1.jpg

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

            I would go with a simple main.cpp just instantiating a QCoreApplication to see if it compiles. I would guess you somehow mixed up the include dirs.

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

            M.H.HM 1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              I would go with a simple main.cpp just instantiating a QCoreApplication to see if it compiles. I would guess you somehow mixed up the include dirs.

              M.H.HM Offline
              M.H.HM Offline
              M.H.H
              wrote on last edited by
              #5

              @Christian-Ehrlicher I have created a new console project. It is compiled at the first with the MSVC2017-64bit. But after including QDebug header and using a simple qDebug() to print something on the screen an error is reported.

              Error :

              F:\Qt\Qt5.12.1\5.12.1\msvc2017_64\include\QtCore\qvariant.h:247: error: C2535: 'QVariant::QVariant(const QRect &)': member function already defined or declared

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

                You must have mixed up your includes. Maybe the msvc compiler option '/showIncludes' helps you to find out what's going wrong.
                Also 'member function already defined or declared' should print out a filename where the previous definition is.

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

                M.H.HM 1 Reply Last reply
                0
                • Christian EhrlicherC Christian Ehrlicher

                  You must have mixed up your includes. Maybe the msvc compiler option '/showIncludes' helps you to find out what's going wrong.
                  Also 'member function already defined or declared' should print out a filename where the previous definition is.

                  M.H.HM Offline
                  M.H.HM Offline
                  M.H.H
                  wrote on last edited by M.H.H
                  #7

                  @Christian-Ehrlicher Thanks for your mention. I compared the qvariant.h file in 32-bit MSVC with 64-bit MSVC versions. I found out that QRect was replicated in the 64-bit version. I changed it to QRectF and then it works. But, some other errors arose.
                  So, I replaced the include folder of 64-bit with 32-bit one. One project works fine and another one has some errors. I think I require to re-install MSVC-64bit again.

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

                    rename in 64bit include folder to include.old and copy over the 32bit include folder to the 64bit dir and see if it helps. The boh directories should not differ.

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

                    M.H.HM 1 Reply Last reply
                    0
                    • Christian EhrlicherC Christian Ehrlicher

                      rename in 64bit include folder to include.old and copy over the 32bit include folder to the 64bit dir and see if it helps. The boh directories should not differ.

                      M.H.HM Offline
                      M.H.HM Offline
                      M.H.H
                      wrote on last edited by
                      #9

                      @Christian-Ehrlicher In fact, I did. But the linking error on shell32.lib arose.

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

                        Ok, re-download Qt/64bit :)

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

                        M.H.HM 1 Reply Last reply
                        0
                        • Christian EhrlicherC Christian Ehrlicher

                          Ok, re-download Qt/64bit :)

                          M.H.HM Offline
                          M.H.HM Offline
                          M.H.H
                          wrote on last edited by
                          #11

                          @Christian-Ehrlicher I installed Qt 5.12.9 and compile with MSVC2015-64bit & MSVC2017-64bit. But I have an error :

                          error: LNK1181: cannot open input file 'shell32.lib'

                          M.H.HM 1 Reply Last reply
                          0
                          • M.H.HM M.H.H

                            @Christian-Ehrlicher I installed Qt 5.12.9 and compile with MSVC2015-64bit & MSVC2017-64bit. But I have an error :

                            error: LNK1181: cannot open input file 'shell32.lib'

                            M.H.HM Offline
                            M.H.HM Offline
                            M.H.H
                            wrote on last edited by
                            #12

                            @M-H-H I tried to add path of shell32.lib to .pro file on these was :

                            LIBS += -L'C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/um/x86/shel32.lib'
                            LIBS += -L'C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/um/x86'

                            and also add shell32.lib via menu appeared by right-clicking on the project.

                            But didn't work.

                            aha_1980A 1 Reply Last reply
                            0
                            • M.H.HM M.H.H

                              @M-H-H I tried to add path of shell32.lib to .pro file on these was :

                              LIBS += -L'C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/um/x86/shel32.lib'
                              LIBS += -L'C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/um/x86'

                              and also add shell32.lib via menu appeared by right-clicking on the project.

                              But didn't work.

                              aha_1980A Offline
                              aha_1980A Offline
                              aha_1980
                              Lifetime Qt Champion
                              wrote on last edited by aha_1980
                              #13

                              @M-H-H said in Build failed with MSVC2017-64bit but works fine with MSVC2017-32bit:

                              shel32.lib

                              Are you sure there is no typo in that?

                              LIBS += -L'C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/um/x86/shel32.lib'
                              LIBS += -L'C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/um/x86'

                              Note that the second line is useless, and the first one is wrong ;)

                              Correct would be: LIBS += -L"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/um/x86" -lshell32

                              If it still does not work, please post the linker command call and messages from Compile Output, and make sure the referenced .lib file has the correct architecture (x86 vs. x64).

                              Regards

                              Qt has to stay free or it will die.

                              1 Reply Last reply
                              1

                              • Login

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