setPosition(Bo-6ren">
gpt4 book ai didi

c++ - 无法解析基于模板的标识符 "get".Netbeans 8.1

转载 作者:搜寻专家 更新时间:2023-10-31 02:16:13 24 4
gpt4 key购买 nike

我的问题是:

我收到了帖子主题中显示的警告。这真是令人沮丧。 自动完成 不适用于代码,旁边会出现警告。 标准设置为 C++14

例如:

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

它给了我一个警告,当我尝试编写另一个 Boxes[2] 时。autocomplete 不起作用。

一个对象的声明:

<shared_ptr<ofxBox2dRect>> Boxes;

我尝试使用这些链接解决我的问题:

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

还有很多,但它们对我没有帮助:(我重复了项目等)

我的 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;我重建、清理并重现了该项目,但没有帮助。;(

感谢您的帮助;)

最佳答案

我遇到了同样的问题。问题在于 boost predef/os/bsd.h header 。它在 #ifndef BOOST_PREDEF_OS_BSD_H 守卫的#else block 中#includes 5 个文件。这意味着如果这 5 个文件中的任何一个还包含 bsd.h(它们包含),则此头文件无法防止递归。

我的解决方案是编辑 predef/os/bsd.h 文件并在 #else block 中添加递归保护 - 因此,从第 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 代码帮助很开心,我的代码仍然可以正确链接和编译。

关于c++ - 无法解析基于模板的标识符 "get".Netbeans 8.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37236721/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com