7

I've seen similar posts around about this but can't get Netbeans to just stop showing the error message "Unable to resolve identifier nullptr" all over my code when it's working fine. I have C++11 enabled properly, not sure what the problem is?

Instinct
  • 349
  • 1
  • 3
  • 10

3 Answers3

8

For Netbeans 7.4

In Project Properties:

Set "C Standard" to "C11" for the editor and "Additional Options" add "-std=c++0x" for the compiler

In my case, I had to close and reload the files and the error mark disappears.

Edit:

This is not a 100% working Solution, sorry.

testo
  • 1,052
  • 2
  • 8
  • 24
  • awesome that worked without even reloading the files! thanks :D – Instinct Mar 21 '14 at 19:34
  • Today, I see it is not a solution for me. I think yesterday, I forgot to rebuild. Well, setting "C Standard" to "C11" also add a new parameter "-std=c++11" to the building process, which gcc 4.6 don't know. – testo Mar 22 '14 at 08:34
  • http://stackoverflow.com/questions/11921138/netbeans-c-c-7-2-std-c11-not-recognized-by-gcc-v4-6-or-lower – testo Mar 22 '14 at 08:36
1

I remember that there was a bug report filed in 2012 about this issue to the Netbeans developers (it should be solved right now).

Anyways try to set the GCC flag for the C++11 support to: -std=c++11, which can be done in Project Properties -> Build -> C++ Compiler -> Additional Options, unless that's what you have already done, then I got nothing.

imkort
  • 81
  • 1
  • 8
  • Haha that's weird it was supposed to be fixed in 7.3 but still same error in 7.4? I am using `-std=c++11` but netbeans is still mad =/ also using `g++ 4.8.2` if that changes anything – Instinct Mar 04 '14 at 23:10
  • According to [this](http://stackoverflow.com/questions/3756473/what-header-file-needs-to-be-included-for-using-nullptr-in-g) you should be fine with `g++ 4.8.2`. I have no idea what might be wrong here, you might also try the `__null` extension - that was used when the `nullptr` was only an idea as an industry proposal. You might also want to check [this](http://stackoverflow.com/questions/2419800/can-nullptr-be-emulated-in-gcc)(emulating nullptr under gcc). That's all I got. – imkort Mar 04 '14 at 23:37
0

These solutions aren't working for me so I'm throwing in a #define nullptr nullptr which seems to do the trick.

Museful
  • 6,711
  • 5
  • 42
  • 68