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

c++, c++11, qt5, visual-c++, visual-studio-2010

Solution

You can simply put:

CONFIG += c++11

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

Problem

I'm trying to build a C++ app on Windows using Qt. My setup is: - Installed Vs2008,2010,2012 - Installed Qt 5 RC1 Now when I #include and try to use std::unique_ptr it tells me that its not defined, so I looked in VS2010 headers and saw that _HAS_CPP0X needs to be defined, so I added it to the .pro as DEFINES += _HAS_CPP0X This still had no effect, so I ctrl+clicked the #include memory only to find its using the memory header from: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include Which really doesn't have any std::unique_ptr in there! Surely it should be looking at: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include ? I figured I'd include memory via the full path but this still fails with errors in the included memory header itself relating to C++11 things such as move and rvalue references. So what I'd like to know is: - Can Qt on Windows use C++11 features supported by Vs2010? - If yes then how? - If no then I'm very disappointed as developing a cross platform Qt 5 app on Linux means its not cross platform since its impossible to build it for any other platforms! Edit: Just so the solution to this is clear: Download the source of Qt5 and build it with MinGW and you'll be all set (inc the C++11 pro option in the accepted answer).

Original source

Related problems