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:
[[Category:HowTo]]
[[Category:HowTo]]


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


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


== In Qt Creator build settings ==
== In Qt Creator build settings ==
Line 13: Line 21:
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 > Build steps > qmake section >additional arguments


</code>“QMAKE_CXXFLAGS ''= -std=c''+0x”</code>
</code>“QMAKE_CXXFLAGS ''= -std=c''+0x”</code>


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

Revision as of 09:26, 25 February 2015


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