can't run QT6 in visual studio 2022
-
hello, I installed Visual studio 2022, then I installed QT (msvc + mingw), but as I said, I can't run it, it gives all kinds of errors. I brought C++ Build 17 but nothing changed. What exactly should I do while installing?
It cannot logically find the exe to run because the compilation is not working properly. I tried it in VS 2019 and it was the same on it.Build started... 1>------ Build started: Project: QtWidgetsApplication2, Configuration: Debug x64 ------ 1>QtWidgetsApplication2.cpp 1>main.cpp 1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\include\cstddef(12,10): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory (compiling source file main.cpp) 1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\include\cstddef(12,10): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory (compiling source file QtWidgetsApplication2.cpp) 1>Done building project "QtWidgetsApplication2.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
-
@HerrWinfried Have you installed Windows SDK?
-
@HerrWinfried This is the C++ standard you use. This does not answer @artwaw's question if you properly installed the WindowsSDK. The error you're showing us does not come from Qt but from a missing header file provided by MSVC / WindowsSDK - there is nothing Qt can do against this.
-
@Christian-Ehrlicher said in can't run QT6 in visual studio 2022:
@HerrWinfried This is the C++ standard you use. This does not answer @artwaw's question if you properly installed the WindowsSDK. The error you're showing us does not come from Qt but from a missing header file provided by MSVC / WindowsSDK - there is nothing Qt can do against this.
Thanks for the info, I'll upload it again and have a look.
The strange thing is that I can compile via QT Creator. however, an exclamation point appears next to it on the build screen.
@JoeCFD said in can't run QT6 in visual studio 2022:
Qt6 requires c++17. Try the following:
To set this for a project:- Right click a project, go to Properties
- Select Configuration Properties > C/C++ > Language
- For C++ Language Standard select "ISO C++17 Standard (/std:c++17)"
I mentioned it in the image above, it's already set like that. Thanks anyway.
-
@HerrWinfried It might have been added to your project.
Check your pro file and you may find
CONFIG += c++17if you use cmake, it may have included
set(CMAKE_CXX_STANDARD 17)But I am surprised that vs 2022 does not have c++17 as default
-
@HerrWinfried said in can't run QT6 in visual studio 2022:
however, an exclamation point appears next to it on the build screen
If you put cursor over it: what does it say?
-
@HerrWinfried said in can't run QT6 in visual studio 2022:
I mentioned it in the image above, it's already set like that. Thanks anyway.
Perhaps, but you select an x86 debugger for a amd64 compiler. I don't thing this is valid configuration.
-
@jsulm said in can't run QT6 in visual studio 2022:
@HerrWinfried said in can't run QT6 in visual studio 2022:
however, an exclamation point appears next to it on the build screen
If you put cursor over it: what does it say?
@KroMignon said in can't run QT6 in visual studio 2022:
@HerrWinfried said in can't run QT6 in visual studio 2022:
I mentioned it in the image above, it's already set like that. Thanks anyway.
Perhaps, but you select an x86 debugger for a amd64 compiler. I don't thing this is valid configuration.
My result did not change when I did x64
-
@HerrWinfried I guess Qt does not yet support C++ compiler from Visual Studio 2022.
You can ask Qt devs on their mailing list. -
@jsulm said in can't run QT6 in visual studio 2022:
I guess Qt does not yet support C++ compiler from Visual Studio 2022.
You can ask Qt devs on their mailing list.Visual Studio 2022 toolchain support/detection has been added into Qt Creator 6.0 (cf release note: https://code.qt.io/cgit/qt-creator/qt-creator.git/plain/dist/changes-6.0.0.md)
First RC has been published at 11.11 (cf. https://www.qt.io/blog/qt-creator-6-rc-released) -
@KroMignon said in can't run QT6 in visual studio 2022:
@jsulm said in can't run QT6 in visual studio 2022:
I guess Qt does not yet support C++ compiler from Visual Studio 2022.
You can ask Qt devs on their mailing list.Visual Studio 2022 toolchain support/detection has been added into Qt Creator 6.0 (cf release note: https://code.qt.io/cgit/qt-creator/qt-creator.git/plain/dist/changes-6.0.0.md)
First RC has been published at 11.11 (cf. https://www.qt.io/blog/qt-creator-6-rc-released)Sounds like something that won't fix my problem in visual studio 2022. Thanks again for the information.
-
@HerrWinfried According to https://www.qt.io/blog/qt-vs-tools-for-visual-studio-2022 it should work, but I'm not sure about Qt itself.
-
That's the point that confuses me, but anyway, I prefer to wait a few weeks for now.
-
@HerrWinfried
The problem is that VS2022 doesn't return by default the right value for__cplusplus
No idea if that's a bug or a feature in VS2022. However, here the solution how to overcome this issue:
https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-170cheers
Greg