Solved How to enable C++17 with MSVC17
-
I am evaluating Qt and it is my very first time using it.
My existing code base is c++17 but I am unable to figure out how to force compilation under C++17.
I read a number of past posts on the topic but I must be missing sometime because none of the suggestions seem to work.
Can any one explain very simply what to do ?The "kit" i am using is Qt 5.12..2 desktop MSVC2017 64bit
I have the most current MSVC version installed on my machine, actually VS17 compiles my code without a issue . -
Hi and welcome to the forums
I think you use QMAKE_CXXFLAG
and /std:c++17 ( in .pro file)
as i understand from google.
it used to be CONFIG += c++1z ( in .pro file)
but i have not tested with 2017 if that still works.
so i would try
QMAKE_CXXFLAGS += -std=c++17
and then clean all/ run qmake in the menu and rebuild all. -
Thanks a lot. Your response put me on the right track.
The following modification of the .pro file works#CONFIG += c++11
QMAKE_CXXFLAGS += /std:c++17 -
it used to be CONFIG += c++1z ( in .pro file)
and thats still the case. You can also use
CONFIG += c++17
starting with Qt 5.12, but 1z is compible with older versions.