If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

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

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.

Re: About Error C2061 - VS 2010

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 ?

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

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.