Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to enable C++17 with MSVC17
Forum Updated to NodeBB v4.3 + New Features

How to enable C++17 with MSVC17

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CABrouwers
    wrote on last edited by
    #1

    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 .

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      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.

      aha_1980A 1 Reply Last reply
      0
      • C Offline
        C Offline
        CABrouwers
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        1
        • mrjjM mrjj

          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.

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @mrjj

          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.

          Qt has to stay free or it will die.

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved