5

I use conan-installed Qt-6.2.2. I created Qt Widgets Project in VS-2019, switched language to std:c++17, added /Zc:__cplusplus to additional options.

Since this is conan-installed QT, it don't have Qt.props, so I manually created one which includes the props file generated by conan install.

enter image description here

But it still complains:

Severity Code Description Project File Line Suppression State 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." QtWidgetsApplication2 D:.conan\579957\1\include\QtCore\qglobal.h 94

user1633272
  • 2,007
  • 5
  • 25
  • 48

3 Answers3

3

Try setting the options -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -permissive- -Zc:__cplusplus -Zc:externConstexpr -utf-8 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458.

I had the same issue with Qt6.2.0 and Qt-VS-Tools2.7.2 in VS2019.

Setting only /Zc:__cplusplus as the error message proposes did not solve it, but setting the options above worked for me.
(I copied them from an old project where they were autogenerated)

Bence
  • 71
  • 1
  • 5
0

In Visual Studio, Changing "Properties->General-> C++ Language standard" to $(Qt_STDCPP_) solved the problem form me.

Adel G.Eibesh
  • 481
  • 4
  • 6
0

I also had the same issue in VS2019 with qt-vsaddin-msvc2019-2.5.2-rev.01. I had to install qt-vsaddin-msvc2019-2.8.1, switch the "C++ Language Standard" to std:c++17 and add /Zc:__cplusplus to additional options.