About Error C2061 - VS 2010
Hi ! I am currently working on a large software involving VS 2010 and a bunch of classes. I'm having a lot of compilation errors C2061 about the class A. All these errors are in header files involving pointer to that class A. I checked not having circular references. I have forward reference to that class A at the top of each concerned header and just after "#include ...". When moving the forward reference to the class A just before the lineinvolving the pointer I don't have compilation error any more. Could you please tell me why it's so ? Many thanks.
Re: About Error C2061 - VS 2010
Re: About Error C2061 - VS 2010
Thanks.
Could you please answer my question ?
Re: About Error C2061 - VS 2010
Quote:
Originally Posted by
mulfycrowh
Thanks.
Could you please answer my question ?
You mean this question?
Quote:
When moving the forward reference to the class A just before the lineinvolving the pointer I don't have compilation error any more. Could you please tell me why it's so ?
Well, the simple answer is that you were violating the rule of having an undefined type, and you were using it. By moving the declaration to where the compiler knows the type, the mistake was corrected. What else could it be?
It would have helped if you actual provided a code sample instead of describing what you're doing.
Regards,
Paul McKenzie
Re: About Error C2061 - VS 2010
Quote:
Originally Posted by
mulfycrowh
I have forward reference to that class A at the top of each concerned header and just after "#include ...". When moving the forward reference to the class A just before the lineinvolving the pointer I don't have compilation error any more. Could you please tell me why it's so ?
Quote:
Originally Posted by
mulfycrowh
Could you please answer my question ?
I wonder how that could be answered without seeing what your real code looks like. There may be some syntax error. Or some conditional compilation that hides that forward declaration. Or something else that you missed or did not mention.
Re: About Error C2061 - VS 2010
My software is very huge : tens of classes. So difficult to post here unless you get it on a private message. Thanks a lot
Re: About Error C2061 - VS 2010
Quote:
Originally Posted by
mulfycrowh
My software is very huge : tens of classes. So difficult to post here unless you get it on a private message. Thanks a lot
You don't need to post your "very huge" code. Only some very small files that reproduce your problem!
Re: About Error C2061 - VS 2010
Quote:
Originally Posted by
mulfycrowh
My software is very huge : tens of classes.
So seriously, you want us to figure out why your "huge software" is giving you a compilation error, and we don't even know a single line of your code?
Well since you're the maintainer of this code, then the answer is the one I gave you previously. It is now your job in figuring out why the definition is unknown, given all the reasons Igor pointed out.
Regards,
Paul McKenzie