Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    Installation and Deployment
    4
    13
    493
    Loading More Posts
    • 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.H
      M.H.H last edited by

      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 Reply Quote 0
      • M.H.H
        M.H.H @Christian Ehrlicher last edited by M.H.H

        @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 Reply Quote 0
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          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 Reply Quote 0
          • M.H.H
            M.H.H last edited by M.H.H

            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 Reply Quote 0
            • Christian Ehrlicher
              Christian Ehrlicher Lifetime Qt Champion last edited by

              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 has to stay free or it will die.

              M.H.H 1 Reply Last reply Reply Quote 0
              • M.H.H
                M.H.H @Christian Ehrlicher last edited by

                @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 Reply Quote 0
                • Christian Ehrlicher
                  Christian Ehrlicher Lifetime Qt Champion last edited by

                  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 has to stay free or it will die.

                  M.H.H 1 Reply Last reply Reply Quote 0
                  • M.H.H
                    M.H.H @Christian Ehrlicher last edited by M.H.H

                    @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 Reply Quote 0
                    • Christian Ehrlicher
                      Christian Ehrlicher Lifetime Qt Champion last edited by

                      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 has to stay free or it will die.

                      M.H.H 1 Reply Last reply Reply Quote 0
                      • M.H.H
                        M.H.H @Christian Ehrlicher last edited by

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

                        1 Reply Last reply Reply Quote 0
                        • Christian Ehrlicher
                          Christian Ehrlicher Lifetime Qt Champion last edited by

                          Ok, re-download Qt/64bit :)

                          Qt has to stay free or it will die.

                          M.H.H 1 Reply Last reply Reply Quote 0
                          • M.H.H
                            M.H.H @Christian Ehrlicher last edited by

                            @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.H 1 Reply Last reply Reply Quote 0
                            • M.H.H
                              M.H.H @M.H.H last edited by

                              @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_1980 1 Reply Last reply Reply Quote 0
                              • aha_1980
                                aha_1980 Lifetime Qt Champion @M.H.H last edited by aha_1980

                                @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 Reply Quote 1
                                • First post
                                  Last post