Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Member declaration not found

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.

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.

How do I fix this problem?

like image 907
codereviewanskquestions Avatar asked Feb 17 '12 05:02

codereviewanskquestions


2 Answers

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

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.

Here's an example:

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

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

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

like image 147
vitaut Avatar answered Nov 08 '22 17:11

vitaut


I also experienced this problem several times in Eclipse though building is successful. We can simply solve this problem by rebuild the C/C++ index in project menu. :)

like image 35
Srijeyanthan Avatar answered Nov 08 '22 19:11

Srijeyanthan