NetBeans' "Unable to resolve identifier std" error

Tried to use some C++ STL includes to no avail. But it was odd, NetBeans was underlining my include's with a red groovy line, and still managed to compile successfully (obvious, because gcc is the compiler, not NB).

So this:


#include <string>

and


std::string m_strTest;

were both underlined, and a "Unable to resolve identifier std" error appeared to the left, with the classic question mark with red background signal.

I was using NB 6.7; tried with NB 6.8 Beta and the problem persisted.

But turns out it was a very simple fix. Thanks to this post which suggested to use CTRL+ALT when hovering over include's, I found out that several include paths such as /usr/lib/include/c++/4.3 weren't found (they were marked in red, not surprisingly). So if netbeans couldn't find those directories, it wasn't able to determine whether std:: was a proper identifier or not.

Simple test:


sole@courgette:~$ ls -la /usr/include/c++
total 20
drwxr-xr-x  3 root root  4096 2009-11-01 11:47 .
drwxr-xr-x 65 root root 12288 2009-11-24 17:18 ..
drwxr-xr-x 10 root root  4096 2009-11-01 11:22 4.4
lrwxrwxrwx  1 root root     3 2009-11-01 11:22 4.4.1 -> 4.4

ahh so it's not 4.3 but 4.4!

So I went to Tools -> Options -> C/C++ -> Code Assistance and replaced the occurrences of 4.3 with 4.4 where appropriate. All worked perfectly from that point onwards.

It's strange; I don't remember having updated GCC recently (apart from the update to Karmic Koala). In any case I hadn't been using NetBeans with C++ and std recently either, so maybe the problem was there waiting for me to stumble upon it :-)