title: Can't use c++17 features using g++ 7.2 in QtCreator
body: <p>I have recently updated gcc and g++ to version 7.2. I would like to try out <code>std::experimental::any</code> and <code>std::variant</code> in particular, and I am using Qt 5.9.1 in QtCreator.</p>
  
  <p>So far I have written this in the project file:</p>
  
  <pre><code>CONFIG += c++17
  </code></pre>
  
  <p>And I have added the correct headers in the correct places:</p>
  
  <pre><code>#include &lt;variant&gt;
  #include &lt;experimental/any&gt;
  </code></pre>
  
  <p>Any works fine, no problems there. However, when I include the variant header file, I get this error:</p>
  
  <pre><code>/usr/include/c++/7/bits/c++17_warning.h:32: error: #error This file requires compiler and library support for the ISO C++ 2017 standard. This support must be enabled with the -std=c++17 or -std=gnu++17 compiler options.
  </code></pre>
  
  <p>#error This file requires compiler and library support \
    ^~~~~</p>
  
  <p>I have tried a variety of things in the project file, here is the full list:</p>
  
  <pre><code>CONFIG += c++17
  </code></pre>
  
  <p>&amp;</p>
  
  <pre><code>CONFIG += c++1z
  </code></pre>
  
  <p>&amp;</p>
  
  <pre><code>QMAKE_CXXFLAGS += -std=c++17
  </code></pre>
  
  <p>&amp;</p>
  
  <pre><code>QMAKE_CXXFLAGS += -std=c++1z
  </code></pre>
  
  <p>&amp;</p>
  
  <pre><code>CONFIG += c++17
  QMAKE_CXXFLAGS += -std=c++17
  </code></pre>
  
  <p>&amp;</p>
  
  <pre><code>CONFIG += c++1z
  QMAKE_CXXFLAGS += -std=c++1z
  </code></pre>
  
  <p>&amp;</p>
  
  <pre><code>CONFIG += c++11
  CONFIG += c++14
  CONFIG += c++17
  </code></pre>
  
  <p>That's every stab in the dark I could think of. What am I missing? And why does <code>experimental::any</code> compile when variant doesn't?</p>
  
  <p>I know I shouldn't use <code>CONFIG += c++xx</code> and <code>QMAKE_CXXFLAGS</code> together in this way, but I thought I'd give it a go as nothing else works. For bonus points, I'm also wondering, should I add the CONFIG calls for 14 and 11 when I already CONFIG for 17?</p>
  
  <p>EDIT:</p>
  
  <p>Here is the compiler output with most of my filenames scrubbed out:</p>
  
  <pre><code>18:04:10: Running steps for project AIQt...
  18:04:10: Configuration unchanged, skipping qmake step.
  18:04:10: Starting: "/usr/bin/make" 
  /home/pete/Qt/5.9.1/gcc_64/bin/qmake -o Makefile ../AIQt/AIQt.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
  WARNING: Failure to find: ../src/stdafx.h
  WARNING: Failure to find: ../src/Csound/csd.h
  g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_DATAVISUALIZATION_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../AIQt -I. -I../src -I../src/AIBase -I../src/Maths -I../src/Random -isystem /usr/local/include/csound -I../../../../Qt/5.9.1/gcc_64/include -I../../../../Qt/5.9.1/gcc_64/include/QtDataVisualization -I../../../../Qt/5.9.1/gcc_64/include/QtWidgets -I../../../../Qt/5.9.1/gcc_64/include/QtGui -I../../../../Qt/5.9.1/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I. -I../../../../Qt/5.9.1/gcc_64/mkspecs/linux-g++ -o main.o ../AIQt/main.cpp
  In file included from /usr/include/c++/7/variant:35:0,
                   from ..###,
                   from ..###,
                   from ..###,
                   from ..###,
                   from ..###,
                   from ..###,
                   from ..###,
                   from ..###:
  /usr/include/c++/7/bits/c++17_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2017 standard. This support must be enabled with the -std=c++17 or -std=gnu++17 compiler options.
   #error This file requires compiler and library support \
    ^~~~~
  In file included from ..###,
                   from ..###
                   from ..###,
                   from ..###,
                   from ..###,
                   from ..###,
                   from ..###:
  ../src/AIBase/Geno.h:70:18: error: ‘variant’ in namespace ‘std’ does not name a type
               std::variant m_valueVariant;
                    ^~~~~~~
  In file included from ..###,
                   from ..###,
                   from ..###,
                   from ..###,
                   from ..###,
                   from ..###:
  ../src/AIBase/Pheno.h:22:13: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
               const double getGenoValue(size_t genoIndex) const;
               ^~~~~
  ../src/AIBase/Pheno.h:24:13: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
               const UserRating getRating() const;
               ^~~~~
  In file included from ..###,
                   from ..###:
  ../AIRadioQt/GraphDialog.h:16:15: warning: declaration ‘struct ar::ai::ClusterList’ does not declare anything
   class ar::ai::ClusterList;
                 ^~~~~~~~~~~
  make: *** [main.o] Error 1
  18:04:13: The process "/usr/bin/make" exited with code 2.
  Error while building/deploying project AIQt (kit: Qt 5.9.1 GCC 64bit)
  The kit Qt 5.9.1 GCC 64bit has configuration issues which might be the root cause for this problem.
  When executing step "Make"
  18:04:13: Elapsed time: 00:03.
  </code></pre>
  
  <p>ANSWER:</p>
  
  <p>As mentioned by nwp, I just had to clean it and rebuild.</p>
  
  <p>Another poster also commented that <code>CONFIG += c++17</code> doesn't appear to be supported yet, so it is necessary to use <code>QMAKE_CXXFLAGS += -std=c++17</code>. He quickly deleted his comment though, so I am unable to thank him personally for going to the effort of checking the docs for me.</p>