drowdemon drowdemon - 8 months ago 68
C++ Question

Netbeans code completion screwed up

Something has gotten horribly screwed up in my netbeans configuration, and I cannot figure out what it is or how to fix it.
I'm running netbeans 8.0 c++ on debian 7.4.
When I have this code:

#include <cstdlib>
#include <vector>

using namespace std;

int main(int argc, char** argv)
vector<int> h;
h.push_back(4); //THIS LINE
return 0;

Netbeans underlines the line I have a comment on in red and says it's unable to resolve identifier push_back. When I just type
the suggestions come up with a bunch of vector constructors, but no methods like push_back or erase. I can't understand why that is, it was working an hour ago and I haven't changed anything since. It broke when I opened one of my projects.

I've tried opening and closing the project, closing and opening netbeans, rebooting my computer, and reinstalling netbeans. Nothing worked.


Solution found : OpenJDK 7 is buggy.

To solve this problem I installed Oracle JDK 1.7 in my home directory, and I removed three directories ~/.cache/netbeans, ~/.netbeans and ~/.nbi. I updated the netbeans_jdkhome variable in the file ~/netbeans-dev-201405050001/etc/netbeans.conf to the path of Oracle JDK 1.7.

Now the C++ Netbeans parser works perfectly, whatever the complexity of statements.

    Product Version: NetBeans IDE Dev (Build 201405050001)
    Java: 1.7.0_55; Java HotSpot(TM) Client VM 24.55-b03
    Runtime: Java(TM) SE Runtime Environment 1.7.0_55-b13
    System: Linux version 3.2.0-4-686-pae running on i386; UTF-8; fr_FR (nb)
    User directory: /home/admin/.netbeans/dev
    Cache directory: /home/admin/.cache/netbeans/dev