Unrecognized command line option "-std=c++11" c++ in Netbeans 7.2
Asked Answered
O

2

6

I am trying to use C++11. After sifting through the internet I found that all I have to do is right click on my project -> properties and under the "C++ standard" select c++ 11. When I run the program with C++ 11, I get this error "unrecognized command line option -std=c++11. One solution people have said is to add -g -std=c++0x in the "Additional Options" but then I get "unrecognized command line option -std=c++0x. I have downloaded gcc-4.7.1.tar.gz but I have no idea what to do with it.

Does anyone know how to get rid of this error or know how to make net beans compile with c++11?

Overhasty answered 11/9, 2012 at 20:23 Comment(10)
Which version of GCC are you using? Superficially, it appears to be one that does not, in fact, recognize the C++11 standard. If your version is older than 4.7, that is quite plausible. Check with gcc --version.Whitfield
If you've downloaded the source for GCC 4.7.1, you now need to build it. This is a modestly complex operation. You'll need to make sure you have sufficiently recent versions of the GMP, MPFR and MPC libraries (or build them — in the correct order, which is GMP, MPFR, MPC, if I remember correctly). With those installed, you then create a directory gcc-4.7.1-obj where you have gcc-4.7.1 (the extracted source), and cd gcc-4.7.1-obj. Then you run ../gcc-4.7.1/configure (adding whatever options are necessary), followed by make bootstrap. It is a good idea to log the build.Whitfield
There are a lot of options that you might need to provide to configure, and there are endless things that might go wrong, too. The outline steps above are no more than that — an outline (and an optimistic outline at that). Note that you need several gigabytes of spare space to build GCC (less than 4 spare GiB might cause trouble).Whitfield
Depending on your operating system, there should be a way to install a newer gcc without having to build it from source. What OS are you using?Geanticline
Your question seems to be either "How do I install gcc 4.7?" or "How do I select an installed compiler in Netbeans 7.2?"Racine
@JonathanLeffler That seems really complex. I can try it though. Then how do I get an IDE that can run C++11?Overhasty
@KeithThompson I am running windows 7. I managed to get NEtbeans up and running using gcc by following netbeans.org/community/releases/60/cpp-setup-instructions.htmlOverhasty
It is moderately complex. If everything goes smoothly, it is a little time consuming, but the computer does it all; if anything goes wrong, you need experience to resolve it. I've built it on both Linux (RHEL 5— don't ask) and Mac OS X 10.7.4, and I've built previous versions of GCC on various machines over the years. As Keith suggested, maybe you should just find a pre-built GCC 4.7.1. It'll be available for your platform, almost certainly.Whitfield
As for IDE, I'm not sure; I've yet to find an IDE that I understand, much less like.Whitfield
I'll try then searching for a pre-built GCC 4.7.1 and see where my search takes me.Overhasty
D
4

bump your gcc version to 4.7+. c++0x is supported since gcc4.3 while c++11 is supported since gcc4.7

Domitiladomonic answered 15/12, 2014 at 5:33 Comment(0)
A
-2

Steps to configure through Netbeans IDE:

  1. Right click on project and goto properties
  2. Go to Build -> C++Compiler
  3. In right hand side panel there are few options go to Basic options -> C++ Standard change its value from C++ 11 to C++ 98
Any answered 26/10, 2012 at 6:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.