CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2013
    Posts
    44

    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.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

  3. #3
    Join Date
    Jan 2013
    Posts
    44

    Re: About Error C2061 - VS 2010

    Thanks.
    Could you please answer my question ?

  4. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: About Error C2061 - VS 2010

    Quote Originally Posted by mulfycrowh View Post
    Thanks.
    Could you please answer my question ?
    You mean this question?
    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

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: About Error C2061 - VS 2010

    Quote Originally Posted by mulfycrowh View Post
    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 View Post
    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.
    Best regards,
    Igor

  6. #6
    Join Date
    Jan 2013
    Posts
    44

    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

  7. #7
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: About Error C2061 - VS 2010

    Quote Originally Posted by mulfycrowh View Post
    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!
    Victor Nijegorodov

  8. #8
    Join Date
    Apr 1999
    Posts
    27,449

    Re: About Error C2061 - VS 2010

    Quote Originally Posted by mulfycrowh View Post
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured