Compiling for MSVC 32Bit - Kit setup
-
I have installed Qt Creator 7.01 with the 'Desktop Qt 5.15.2 MSVC2019 32Bit' kit, but the compiler for both C and C++ are indicated as '<No compiler>', and the 'Compilers' tab (page) does not list a suitable Auto-detected compiler.
My question is, which version of Microsoft Visual Studio should I install, and will Qt autodetect it once installed?
I have already installed Visual Studio 2022, but clearly that is not suitable.
Thanks in advance for any assitance.
-
Thank you Chris - all sorted now.
Initially I couln't find the vcvarsall.bat file, but after also installing the Desktop Development With C++ 'workload', the bat file did appear in the specified folder.
Actually, Qt was then also able to Auto-detect the compiler, so it all worked out rather nicely.Thanks again.
-
The answer is in the kit name already. For that kit you need VS 2019. But if you already have VS 2022 you can just add the older compiler. You don't have to install another VS version entirely.
In VS2022 go to Tools->Get Tools and Features. In the installer switch to the "Individual components" tab and find "MSVC v142 - VS 2019 C++ x64/x86 build tools" and install that. There's a lot of similarly named components there so make sure you select the right one. After doing that Qt Creator should pick up the compilers automatically.
-
Hi Chris - thanks for your assistance.
I did as you suggested, but despite rebooting my machine, Qt has not managed to Auto-detect the newly installed compiler. I tried selecting 'Re-detect' button on the Qt Kits 'Compilers' tab, but that had no effect.
Do I need to manually configure it?
Thanks again. -
Ah yes, sorry. It seems Creator indeed can't automatically detect additional MSVC toolchains. I guess it only does that with full VS installations.
No problem, you should be able to add a custom MSVC compiler that you just installed. In the initialization field enter
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat
adjusting for your actual VS installation directory and version name (Community in my case). select
x86
next to it and enter-vcvars_ver=14.2
in the empty field to the right.
Then select VS2019 from the ABI list below, click Apply and you should be good to go.Just verify that it shows the correct x86 windows msvc2019 pe 32bit info in the grayed out fields. You should be able to select that compiler for your kit.
-
Thank you Chris - all sorted now.
Initially I couln't find the vcvarsall.bat file, but after also installing the Desktop Development With C++ 'workload', the bat file did appear in the specified folder.
Actually, Qt was then also able to Auto-detect the compiler, so it all worked out rather nicely.Thanks again.