Adding QMAKE_CXXFLAGS + = -std = C ++ 11 to the .pro file in qt does not work (on linux 12.04)

Compiler Output:

[main.o] Error 1

cc1plus: error: unrecognized command line option '-std = c ++ 11'

+5
c ++ gcc c ++ 11 qt qmake
Apr 08
source share
2 answers

The solution is to upgrade your old version of gcc on the system. In fact, I am very surprised that you have such an old version on your version of 12.04 Ubuntu. It should have 4.6.3 on failure.

What you could try is C ++ 0x instead of C ++ 11 and see if this works. You can also run the gcc manual by issuing man gcc and find the exact one.

In addition, although we find this, you could just write this in your qmake project file instead of these initial configurations:

 CONFIG += c++11 
+1
Apr 08 '14 at 20:13
source share

As already mentioned in the comments, this has nothing to do with the Qt Creator version, but is caused by the g ++ version, which does not support C ++ 11, for a bit older than g ++ (but note that you need at least 4.3) switch to enable C functions ++ 0x implemented in the compiler, QMAKE_CXXFLAGS += -std=c++0x , you can see the available functions by following the links on this page

+1
Apr 08 '14 at 9:10
source share



All Articles