无法解析基于模板的标识符“get".网豆 8.1

2022-01-05 00:00:00 autocomplete netbeans c++ openframeworks

我的问题是:

我收到了帖子主题中提出的警告.真是让人心慌.自动完成 不适用于代码,除此之外还会出现警告.标准设置为C++14.

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.

例如:

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

它给我一个警告,当我尝试编写另一个 Boxes[2] 时.自动完成不起作用.

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

对象的声明:

<shared_ptr<ofxBox2dRect>> Boxes;

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

  1. 无法解析 netbeans 上的标识符
  2. 无法解析标识符" ,虽然构建成功

还有更多,但他们没有帮助我:(我重复了项目等)

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

我的 NetBeans 版本是 8.1,C++ 插件 1.29.6.1 在 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.

警告列表:

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

我花了几个小时试图解决我的问题.我按照上面给出的链接中提供的步骤进行了操作,但它们对我没有帮助.希望我能在那里找到帮助.

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.

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

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.;(

感谢您的帮助;)

推荐答案

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

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

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

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

现在 netbeans 代码帮助很愉快,我的代码仍然链接和编译没有错误.

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

相关文章