Search code examples
c++netbeansautocompleteopenframeworks

Unable to resolve template based identifier "get". Netbeans 8.1


My problem is:

I am receiving warning which is presented in the topic of a post. It is really flustrating. The autocomplete does not work with the code, beside which the warning occurs. The standard is set to C++14.

For instance:

 Boxes[2].get()->setPosition(Boxes[2].get()->getPosition() + v1);

It gives me a warning and when I try to write another Boxes[2].the autocomplete does not work.

The declaration of an object:

<shared_ptr<ofxBox2dRect>> Boxes;

I tried to solve my problem using these links:

  1. Unable to resolve identifier on netbeans
  2. “Unable to resolve identifier” , although build is successful

And much more but they did not help me: (I repearsed the project etc.)

My NetBeans version is 8.1 and the C++ plugin 1.29.6.1 working on Apricity OS.

I did some research and I receive some of other warnings as well and I think that they are related with my problem.

The list of Warnings:

Recursive directive #include <boost/predef/os/bsd.h> 
Analyzed user include paths and user include headers: 
/usr/include 
/usr/lib 
/usr/lib64 
/usr/share 
/usr/src 
/usr/include/gstreamer-1.0 
/usr/lib/gstreamer-1.0/include 
/usr/include/AL 
/usr/include/alsa 
/usr/include/gtk-3.0 
/usr/include/at-spi2-atk/2.0 
/usr/include/at-spi-2.0 
/usr/include/dbus-1.0 
/usr/lib/dbus-1.0/include 
/usr/include/gio-unix-2.0 
/usr/include/cairo 
/usr/include/pango-1.0 
/usr/include/atk-1.0 
/usr/include/pixman-1 
/usr/include/freetype2 
/usr/include/libpng16 
/usr/include/harfbuzz 
/usr/include/glib-2.0 
/usr/lib/glib-2.0/include 
/usr/include/libdrm 
/usr/include/gdk-pixbuf-2.0 
/home/charllie/of-workspace/libs/fmodex/include 
/home/charllie/of-workspace/libs/glfw/include 
/home/charllie/of-workspace/libs/glfw/include/GLFW 
/home/charllie/of-workspace/libs/kiss/include 
/home/charllie/of-workspace/libs/poco/include 
/home/charllie/of-workspace/libs/tess2/include 
/home/charllie/of-workspace/libs/utf8cpp/include 
/home/charllie/of-workspace/libs/utf8cpp/include/utf8 
/home/charllie/of-workspace/libs/openFrameworks 
/home/charllie/of-workspace/libs/openFrameworks/graphics 
/home/charllie/of-workspace/libs/openFrameworks/math 
/home/charllie/of-workspace/libs/openFrameworks/events 
/home/charllie/of-workspace/libs/openFrameworks/gl 
/home/charllie/of-workspace/libs/openFrameworks/communication 
/home/charllie/of-workspace/libs/openFrameworks/video 
/home/charllie/of-workspace/libs/openFrameworks/3d 
/home/charllie/of-workspace/libs/openFrameworks/utils 
/home/charllie/of-workspace/libs/openFrameworks/app 
/home/charllie/of-workspace/libs/openFrameworks/sound 
/home/charllie/of-workspace/libs/openFrameworks/types 
/home/charllie/of-workspace/libs/openFrameworksCompiled/project 
Analyzed system include paths: 
/usr/include/c++/6.1.1 
/usr/include/c++/6.1.1/x86_64-pc-linux-gnu 
/usr/include/c++/6.1.1/backward 
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include 
/usr/local/include 
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include-fixed 
/usr/include 
/home/charllie/of-workspace 
Include path trail to current file: 
/home/charllie/of-workspace/libs/openFrameworks/graphics/ofPath.cpp: (line 1) 
/home/charllie/of-workspace/libs/openFrameworks/graphics/ofPath.h: (line 6) 
/home/charllie/of-workspace/libs/openFrameworks/graphics/ofPolyline.h: (line 5) 
/home/charllie/of-workspace/libs/openFrameworks/types/ofRectangle.h: (line 6) 
/home/charllie/of-workspace/libs/openFrameworks/utils/ofLog.h: (line 4) 
/home/charllie/of-workspace/libs/openFrameworks/utils/ofFileUtils.h: (line 8) 
/usr/include/boost/filesystem.hpp: (line 16) 
/usr/include/boost/filesystem/path.hpp: (line 29) 
/usr/include/boost/shared_ptr.hpp: (line 17) 
/usr/include/boost/smart_ptr/shared_ptr.hpp: (line 35) 
/usr/include/boost/smart_ptr/detail/spinlock_pool.hpp: (line 25) 
/usr/include/boost/smart_ptr/detail/spinlock.hpp: (line 50) 
/usr/include/boost/smart_ptr/detail/spinlock_sync.hpp: (line 18) 
/usr/include/boost/smart_ptr/detail/yield_k.hpp: (line 28) 
/usr/include/boost/predef.h: (line 17) 
/usr/include/boost/predef/os.h: (line 18) 
/usr/include/boost/predef/os/bsd.h: (line 52) 
/usr/include/boost/predef/os/bsd/bsdi.h: (line 11) 
/usr/include/boost/predef/os/bsd.h: (line 95) 
/usr/include/boost/predef/os/bsd/dragonfly.h: (line 11) 
/usr/include/boost/predef/os/bsd.h: (line 96) 
Ctrl+Alt+Click to open include hierarchy

In my opinion this warning is the most important:

Library File /usr/include/boost/smart_ptr/shared_ptr.hpp 
but there is an recursion #include <boost/predef/os/bsd.h> in included /usr/include/boost/predef/os/bsd/free.h 
Use Ctrl+Alt to show analyzed paths Ctrl+Alt+Click to open file with failed include directive

I spent couple of hours trying to solve my problem. I followed the steps which are presented in links given above, but they did not help me. Hope that there I will find help.

The most important thing for me is to receive the autocomplete fully workable.

I got the autocomplete ON and it works fine, but not in this particular case.

I thought that might be a problem with namespaces so add using namespace std; I rebuilt, cleaned and repearsed the project, but it did not help.;(

Thanks for your help ;)


Solution

  • I was having the same problem. The issue is with the boost predef/os/bsd.h header. It #includes 5 files in the #else block for the #ifndef BOOST_PREDEF_OS_BSD_H guard. This means that this header file is not guarded against recursion if any of those 5 files also includes bsd.h (which they do).

    My solution was to edit the predef/os/bsd.h file and add a recursion guard in the #else block - so, starting at around line 94 my predef/os/bsd.h file now looks like:

    #ifndef BOOST_PREDEF_OS_BSD_H_PREVENT_RECURSION      <-- ADD THIS
    #define BOOST_PREDEF_OS_BSD_H_PREVENT_RECURSION      <-- ADD THIS
    
    #include <boost/predef/os/bsd/bsdi.h>
    #include <boost/predef/os/bsd/dragonfly.h>
    #include <boost/predef/os/bsd/free.h>
    #include <boost/predef/os/bsd/open.h>
    #include <boost/predef/os/bsd/net.h>
    
    #endif                                               <-- ADD THIS
    

    And now netbeans code assistance is happy and my code still links and compiles without error.