Windows C++ Compiler with Full C++11 Support (Should Work with Qt)

How to Program C++11 Using Qt5?

QMAKE_CXXFLAGS += -std=c++0x

Results in an error because you're not using the MinGW compiler. "D9002: Ignoring unknown option -std=c++0x" is an error from the MSVC compiler.

In QtCreator, go to the projects tab(on the left) and change the toolchain you're using. If it hasn't auto-detected MinGW, you're going to have to add it yourself by clicking on the manage button.

How to enable C++11 in Qt Creator?

According to this site add

CONFIG += c++11

to your .pro file (see at the bottom of that web page). It requires Qt 5.


The other answers, suggesting

QMAKE_CXXFLAGS += -std=c++11 (or QMAKE_CXXFLAGS += -std=c++0x)

also work with Qt 4.8 and gcc / clang.

Building Qt project for C++11 standard

Use the qmake project file, add this line: QMAKE_CXXFLAGS += -std=c++11

LE: also 4.6.3 might not support C++11 (as far as i know 4.7 and higher support -std=c++11) so the option for the 0x features implemented might be: QMAKE_CXXFLAGS += -std=c++0x

Enable C++11 Support on Qt with MinGW or VS2012 Compilers

In .pro file, add the line

CONFIG += c++11

Qt Creator 2.6.1 + Qt 5 + C++11 + MSVC2010 compiler

You can simply put:

CONFIG += c++11

in your .pro file. But upgrading your compiler to a recent g++ or clang is highly recommended.



Related Topics



Leave a reply



Submit