Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netbeans C++ return type of templated functions

Tags:

c++

netbeans

For some reason the code completion in netbeans can't figure out the return type of templated functions. Take the following example...

struct Test
{
   int val;
};

int main()
{
     vector<Test> v;
     Test t = {10};
     v.push_back(t);
     cout << v[0].val;  //Netbeans gives the warning "Unable to resolve identifier val"
     return 0;
}

The code compiles and runs fine but what is annoying is that I get this error all over my code when I use vectors. Also the code completion does not seem to work. When I type v[0]. there is no drop down giving me to option to choose val.

I am using netbeans 7.4 along with 64bit MinGW.

like image 320
chasep255 Avatar asked Mar 16 '14 16:03

chasep255


2 Answers

Well there seems to bug in the Netbeans 7.2 version and later it was fixed.

https://netbeans.org/bugzilla/show_bug.cgi?id=172227

You can find the complete discussion and possible resolution on the same problem from the following link. Here you can find how to resolve this problem(possibly).

Netbeans 7.2 shows "Unable to resolve identifier" , although build is successful

like image 160
Mantosh Kumar Avatar answered Sep 30 '22 08:09

Mantosh Kumar


Follow some simple steps to get your identifiers resolved, given on the following link Netbeans 7.2 shows "Unable to resolve identifier" , although build is successful1

like image 43
Suyog Avatar answered Sep 30 '22 09:09

Suyog