Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use C++11 in Qt Creator [duplicate]

I'm using Qt Creator on Ubuntu, and I'd like to use the new C++11 features, however they are not enabled by default.

How can I configure Qt Creator to support the new C++11 features?

like image 462
sashoalm Avatar asked Jul 07 '13 09:07

sashoalm


People also ask

Does Qt support C ++ 11?

Yet, according to this article this version of Qt Creator supports C++11. So how do I enable it? Qt Creator is not a compiler. When you read that "Qt Creator supports C++11" it means that the code-completion engine (Clang in this case) supports C++11 syntax.

Does Qt Creator support C?

In addition, the Qt Creator Bare Metal Device plugin provides support for the following compilers: IAREW is a group of C and C++ bare-metal compilers from the various IAR Embedded Workbench development environments. Note: Currently supported architectures are 8051 , AVR , ARM , STM8 , and MSP430 .

Does Qt support C ++ 14?

qmake got support for CONFIG += c++14 with Qt 5.4, so you can use that for projects where you are comfortable with requiring at least that version of Qt. Be sure to either use the explicit compiler flags, or use the CONFIG option, but not both at the same time, to avoid conflicting switches.

What is .pro file in Qt?

pro file is to list the source files that are involved in a project. Since qmake is used for building Qt and its associated tools, it knows Qt very well and can generate rules for invoking moc, uic, and rcc. As a result, the syntax is very concise and easy to learn.


1 Answers

You can achieve this by adding:

QMAKE_CXXFLAGS += -std=c++11

to your .pro file.

like image 51
Floris Velleman Avatar answered Oct 28 '22 20:10

Floris Velleman