未找到成员声明 [英] Member declaration not found

查看:694
本文介绍了未找到成员声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用常规文本编辑器处理了一个c ++项目。
后来,我将所有文件导入到Eclipse,使其更容易调试。

I have worked on a c++ project using a regular text editor. Later, I imported all the files to Eclipse to make it debugging easier.

在Eclipse中,一件奇怪的事情发生了。
即使我已经包含头文件,它仍然提示成员声明未找到。
头文件具有函数定义。

In Eclipse a weird thing happens. It complains "Member declaration not found" even if I have included the header file. The header file has the function definition.

如何解决此问题?

提前感谢

推荐答案

未找到成员声明是Eclipse静态分析工具生成的错误(此错误报告。因此,我建议将Eclipse CDT更新到最新版本。

"Member declaration not found" is an error produced by the Eclipse static analysis tool (codan). If you get this error, but the compilation succeeds this is a false positive. Older versions of this tool are known to give some false positives, see for example this bug report. So I recommend updating Eclipse CDT to the most recent version.

另一个可能导致此错误的原因是未解析的include,它阻止Eclipse正确解析部分代码。选择索引 - >在项目的上下文菜单中搜索未解析的包含将会提供未解析的包含列表。有关如何修复问题的详细信息,请参见此答案

Another thing that may cause this error is an unresolved include that prevents Eclipse from parsing a portion of your code correctly. Selecting Index -> Search For Unresolved Includes in the context menu of the project will give you the list of unresolved includes. See this answer for the details of how to fix it.

这里有一个例子:

class C {
  void f(std::vector<int>&);
};

void C::f(std::vector<int>&) {} // Member declaration not found

上述示例导致Eclipse CDT中的成员声明未找到错误,即使您包含< vector> 但未解析由于配置错误的包含路径)。

The above example causes "Member declaration not found" error in Eclipse CDT even if you have <vector> included but unresolved (due to misconfigured include paths).

这篇关于未找到成员声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆