Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netbeans code completion screwed up

Tags:

c++

netbeans

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 h. 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.

like image 685
WanderingMathematician Avatar asked Apr 27 '14 19:04

WanderingMathematician


1 Answers

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
like image 164
V. François Avatar answered Sep 22 '22 00:09

V. François