Having trouble setting up MSVC for project in QT Creator
-
Hi!
Im trying to get MSVC working for an example project in QT Creator, since it uses the bluetooth module. I think I've gotten the right compiler installed now, but when I try to build the project i get this error:
"C:\Qt\6.2.1\msvc2019_64\include\QtCore\qglobal.h:94: error: C1189: #error: "Qt requires a C++17 compiler, and a suitable value for __cplusplus. On MSVC, you must pass the /Zc:__cplusplus option to the compiler.""Where can I set this option? I read somewhere that I should set it in Visual Studios project settings, but that doesn't make sense since I have no project there.
Thankful for any replies, feels like I'm missing something basic.
-
Thanks for the quick reply, but that unfortunately doesn't seem to make any difference. I'll attach some pictures regarding the kit/compilers if that might show what I've screwed up. When I use the compiler "Microsoft Visual C++ compiler 16.x.x.x.x.(amd64)", the kit doesn't display any warnings at least. When I use "Microsoft Visual C++ compiler 17.x.x.x.(amd64)", the compiler shows the warning as displayed in the other picture.
-
You need MSVC2017 or higher but you only have some ancient ones (MSVC 2012 and below when I would have to guess from the cl.exe version numbers)
-
@Christian-Ehrlicher Ah, thought I had installed a somewhat recent version of MSVC, where do I go about finding a download? In the Visual Studio installer (Visual Studio Community 2019), I've downloaded what I thought was the recent version of the compiler (see picture). Am I supposed to download it some other way?
Thanks for the help!
-
The you should add this compiler in the Compilers tab in QtCreator as explained in the documentation.
The lastest compiler is shipped with Visual Studio 2019, you're using Visual Studio 2017 -
Hi, thanks once again for the help. Is not Visual Studio Community 2019 (the one I have installed) part of Visual Studio 2019?
Anyways, using the compiler named "Default LLVM 64 bit based on MSVC2019" seemed to do the trick, I thought I had to use one of the ones names "c++ compiler". The example bluetooth project can now run correctly, thanks a bunch for the help everyone! Marking this thread as Solved.