How to use C++11 in your Qt Projects

From Qt Wiki
Revision as of 08:57, 24 February 2015 by Maintenance script (talk | contribs)
Jump to navigation Jump to search


[toc align_right="yes" depth="3"]

= How to use c+11 in your qt projects?
At this moment (march 2014) Qt Creator doesn't add the necessary flags for you by default. You have to do it manually.
h2. In your pro file


add :

QMAKE_CXXFLAGS''= -std=c+''0x // for GCC &lt; 4.7<br />or<br />QMAKE_CXXFLAGS''= -std=c+''11 // for GCC &gt;= 4.7


or

CONFIG''= c++11<code> =

== In Qt Creator build settings ==

you can use the build input fields :

Project &gt; Build steps &gt; qmake section &gt;additional arguments

“QMAKE_CXXFLAGS = -std=c+0x”

Don’t forget the “” in the input field.