无法解析基于模板的标识符“get”。 Netbeans 8.1

时间:2016-05-15 09:42:11

标签: c++ netbeans autocomplete openframeworks

我的问题是:

我收到一条帖子主题中的警告。 它真的很流行。 自动填充不适用于代码,警告发生在该代码旁边。 标准设置为 C ++ 14

例如:

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

它给了我一个警告,当我尝试写另一个Boxes[2].时,自动填充不起作用。

声明对象:

<shared_ptr<ofxBox2dRect>> Boxes;

我尝试使用以下链接解决问题:

  1. Unable to resolve identifier on netbeans
  2. “Unable to resolve identifier” , although build is successful
  3. 还有更多,但他们没有帮助我:(我重复了项目等。)

    我的NetBeans版本是8.1,而C ++插件1.29.6.1正在使用Apricity OS。

    我做了一些研究,我也收到了一些其他的警告,我认为它们与我的问题有关。

    警告列表:

    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
    

    在我看来,这个警告是最重要的:

    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
    

    我花了几个小时试图解决我的问题。我按照上面给出的链接中提供的步骤,但他们没有帮助我。 希望我能找到帮助。

    对我来说最重要的是 接收自动填充完全可行。

    我得到了自动填充 ON ,它运行正常,但在这种情况下却没有。

    我认为这可能是命名空间的问题所以添加using namespace std; 我重建,清理并重复了该项目,但它没有帮助。;(

    感谢您的帮助;)

1 个答案:

答案 0 :(得分:2)

我遇到了同样的问题。问题在于使用boost predef / os / bsd.h 标头。它#include #ifn块中的5个文件,用于#ifndef BOOST_PREDEF_OS_BSD_H保护。这意味着如果这5个文件中的任何一个还包含bsd.h(他们这样做),这个头文件就不会防止递归。

我的解决方案是编辑predef / os / bsd.h文件并在#else块中添加一个递归防护 - 所以,从第94行开始,我的predef / os / bsd.h文件现在看起来像:

#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

现在netbeans代码帮助很高兴,我的代码仍然链接和编译而没有错误。