weird class method not found error [message #1749266] |
Sun, 04 December 2016 23:51 |
David Balažic Messages: 35 Registered: February 2013 |
Member |
|
|
Hi
I have this in a header file:
class Foo
{
public:
Foo(Foo const& other){value=other.value;}
~Foo(void); // hmm, the tilde looks like a minus sign in the forum editer, it is a tilde, not a syntax error
// get value
double getBar() const{ return value;}
double asBar() const{ return value;}
double toBar() const{ return value;}
double foBar() const{ return value;}
private:
double value; // value in meters - internal implementation detail!
}
And this in a CPP file including it:
#include <Foo.h>
void test(Foo x){
x.toBar();
}
This works.
But if I write x.foBar(); insted. then it fails with compile error:
Quote:Method 'foBar' could not be resolved
Also, the ctrl-space expansion does not offer it (but offer all the others).
What could be wrong?
I use:
Eclipse IDE for C/C++ Developers
Version: Neon.1a Release (4.6.1)
Build id: 20161007-1200
with cygwin GNU compiler suite.
I tried to add a new method, but it kept failing. That is why I made it 99% like an existing working method (to rule out any typo or other error).
[Updated on: Sun, 04 December 2016 23:59] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03742 seconds