Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Member declaration not found - size_t as a return value
Member declaration not found - size_t as a return value [message #1824058] Tue, 07 April 2020 03:40 Go to next message
Eclipse UserFriend
Hi,

I was trying to clean all warnings in eclipse and I can't deal with issue below.

When I have a method which as a return value has size_t this cause parsing error. I think I have all paths pointing to the right place.

Currently I use this version, but it applies to older version of Eclipse too.
Eclipse IDE for C/C++ Developers
Version: 2020-03 (4.15.0)
Build id: 20200313-1211

Regards,
Paweł

index.php/fa/37760/0/
index.php/fa/37761/0/

#include <cstdint>
#include <string>

class A
{
	std::size_t
	test();

	std::string
	test(int a);

	std::string
	test(int a, size_t b);

	int
	test(std::string a, size_t b);

};

std::size_t
A::test()
{
	return 0;
}

std::string
A::test(int a)
{
	return "";
}

std::string
A::test(int a, size_t b)
{
	return "";
}

int
A::test(std::string a, size_t b)
{
	return 0;
}

int main() {
	A a();
    return 0;
}
Re: Member declaration not found - size_t as a return value [message #1824220 is a reply to message #1824058] Thu, 09 April 2020 22:18 Go to previous messageGo to next message
Eclipse UserFriend
Works for me:
#include <cstdint>
class X {
	std::size_t Test();
};
std::size_t X::Test() {return 0;}

index.php/fa/37784/0/
I also had no flags using all of your code verbatim.
Maybe you should tell us the error you are getting instead of showing the flag for it.
Also, in the future, please post the minimum code that demonstrates the problem.

[Updated on: Thu, 09 April 2020 22:34] by Moderator

Re: Member declaration not found - size_t as a return value [message #1824221 is a reply to message #1824220] Fri, 10 April 2020 02:43 Go to previous messageGo to next message
Eclipse UserFriend
Thank you for your reply.

I presented so long code, because I wanted to show the problem with opening declaration (parser is confused). It happens only when there is more than one method with the same name.

I've attached parser.log which shows this error:
A declaration could not be found for this member definition: test in file C:\Users\---\eclipse-workspace\test\test.cpp:11

There is something wrong with size_t type in method declaration. If this type is used in other situation everything is fine. If in method declaration I use other complex type (eq. std::string) it works ok.

Maybe I missed something?

Thanks in advance for your help.

index.php/fa/37787/0/
index.php/fa/37788/0/
Re: Member declaration not found - size_t as a return value [message #1824229 is a reply to message #1824221] Fri, 10 April 2020 06:39 Go to previous messageGo to next message
Eclipse UserFriend
Well, if there is something wrong with the definition of size_t
it's hardly surprising that the Indexer would become confused
but it's a secondary effect.

The first step would be to find out the problem with size_t

I haven't used MinGW in a long time.
It seems unusual that __cplusplus would show up in the Symbols dialog.
It's compiler builtin value.
Did you put it there?
If not, where are the rest of the builtin macros?
If so, why?
It may be causing a conflict with the library definitions.
There are other compiler builtins which change with the dialect.

The same with the includes.
Paths and Symbols is supposed to contain paths to YOUR definitions and not the compiler supplier's.
Why aren't these in the compiler builtins list ?
Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc.

Does the code compile?

I changed the dialect used in my tests to c++17 and still got no problems.

If the problem is in the definition of size_t then this isn't a CDT issue at all
and you are posting in the wrong forum.

Are you sure you are using the correct version of MinGW?
Before you ask: there are three major versions:
https://stackoverflow.com/a/59805718/3312726

[Updated on: Fri, 10 April 2020 07:01] by Moderator

Re: Member declaration not found - size_t as a return value [message #1824238 is a reply to message #1824229] Fri, 10 April 2020 10:09 Go to previous message
Eclipse UserFriend
Thank you!

In short words. I had a problem with wrong path to MinGW in PATH.

When I fixed this and removed unnecessary Symbols and Includes it started working!

Regards,
Pawel
Previous Topic:Unresolved inclusion glad.h
Next Topic:Testing for good code?
Goto Forum:
  


Current Time: Thu Jun 19 18:08:53 EDT 2025

Powered by FUDForum. Page generated in 0.08539 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top