How to use C++11 in your Qt Projects

From Qt Wiki
Revision as of 09:26, 25 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 < 4.7
or
QMAKE_CXXFLAGS''= -std=c+''11 // for GCC >= 4.7

or

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

== In Qt Creator build settings ==

you can use the build input fields :

Project > Build steps > qmake section >additional arguments

“QMAKE_CXXFLAGS = -std=c+0x”

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