5

Compiler output:

[main.o] Error 1

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

László Papp
  • 51,870
  • 39
  • 111
  • 135
user3466884
  • 303
  • 1
  • 6
  • 13
  • I think this might be due to the fact that I'm using Qt 2.4.1 or something like that. Downloading the most recent version right now from their website. I originally downloaded it from the ubuntu software center. – user3466884 Apr 08 '14 at 01:16
  • 1
    The problem is more likely the version of compiler on your system. What compiler is 'cc1plus'? Doesn't look like gcc to me. FWIW 2.4.1 is almost certainly the version of QtCreator. Any recent version of the Qt libraries is either 4.x or 5.x – Steve Fallows Apr 08 '14 at 01:21
  • 1
    Possible duplicate of http://stackoverflow.com/questions/14674597/cc1plus-error-unrecognized-command-line-option-std-c11-with-g – anttix Apr 08 '14 at 02:13
  • 1
    Nothing to do with Qt. Everything to do with old compiler. (also, no such thing as linux 12.04) – user3427419 Apr 08 '14 at 04:35
  • Update your QtCreator to version 3, Qt to version 5 and g++ to at least 4.3. and your ubuntu also needs upgrade, it's two years old. – agilob Apr 08 '14 at 09:21
  • 1
    @agilob: I do not follow. 14.04 is not out yet, and 12.04 is the last LTS, so that part is all fine ... – László Papp Apr 08 '14 at 20:13
  • Is the issue resolved now? – László Papp Apr 10 '14 at 14:15
  • Unfortunately, I've been having a lot of other difficulties with Ubuntu and am currently trying to resolve those before I fix this. – user3466884 Apr 10 '14 at 22:24

2 Answers2

1

As others already said in comments, this has nothing to do with Qt Creator version, but is caused by an g++ version that doesn't support C++11, for a little older g++ (but note that you need at least 4.3) the switch to enable the C++0x features implemented in the compiler is QMAKE_CXXFLAGS += -std=c++0x you can see the available features by following links in this page

Zlatomir
  • 6,964
  • 3
  • 26
  • 32
1

The solution is to update your ancient gcc version on the system. In fact, I am quite surprised that you have such an old version on your 12.04 Ubuntu variant. It should have 4.6.3 by deault.

What you could try is c++0x instead of c++11 and see if that makes it work. You could also fire up the gcc manual by issuing man gcc and look for the precise option.

Also, while we are it, you could probably simply write this in your qmake project file instead of such raw configurations:

CONFIG += c++11
László Papp
  • 51,870
  • 39
  • 111
  • 135