How to use C++11 in your Qt Projects: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
=How to use c++11 in your qt projects?=
[[Category:HowTo]]


At this moment (march 2014) Qt Creator doesn’t add the necessary flags for you by default. You have to do it manually.
[toc align_right="yes" depth="3"]


==In your pro file==
= How to use c+''11 in your qt projects?
<br />At this moment (march 2014) Qt Creator doesn't add the necessary flags for you by default. You have to do it manually.
<br />h2. In your pro file  
<br />add :<br /><code>QMAKE_CXXFLAGS''= -std=c+''0x // for GCC &lt; 4.7<br />or<br />QMAKE_CXXFLAGS''= -std=c+''11 // for GCC &gt;= 4.7</code>
<br />or<br /><code>CONFIG''= c++11<code> =


add :<br />
== In Qt Creator build settings ==
 
or <br />
 
==In Qt Creator build settings==


you can use the build input fields :
you can use the build input fields :


Project &gt; Build steps &gt; qmake section &gt;additional arguments
Project &gt; Build steps &gt; qmake section &gt;additional arguments
</code>“QMAKE_CXXFLAGS ''= -std=c''+0x”</code>


Don’t forget the “” in the input field.
Don’t forget the “” in the input field.
===Categories:===
* [[:Category:HowTo|HowTo]]

Revision as of 08:57, 24 February 2015


[toc align_right="yes&quot; depth="3&quot;]

= 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.