Build failed with MSVC2017-64bit but works fine with MSVC2017-32bit
-
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.
-
@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. -
Hi,
Might be a silly question but did you install the corresponding 64 bit Qt build ?
-
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.
-
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.
-
@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
-
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. -
@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. -
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.
-
@Christian-Ehrlicher In fact, I did. But the linking error on shell32.lib arose.
-
Ok, re-download Qt/64bit :)
-
@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 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.
-
@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