locked
Using my old C++ classes in MFC RRS feed

  • Question

  • Hi there

    I start learning MFC, and now i wish to use some of my old clases with Windows Interface not just console.
    I've made the folowing steps, and don't know how to continue. I bet it's easy for you.
    1. Into a dialog based MFC I've aded my old C class (2 files : one header and a .cpp file)

    The error was: fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source? but now i've fixed that by choosing Not Using Precompiled Headers.

    When I instantiate and use oldMyClass in same member function, all works fine.
    I try to instantiate oldMyClass in Dlg constructor and OnOK to use it, but i get error C2065: 'oldMyClass' : undeclared identifier.

    many thx. How to solve that?

    I'm using VS2005

    Thursday, December 13, 2007 6:42 AM

Answers

  • If your classes are independent enough (means all include files are properly added in the CPP file), you can remove the Precompiled Header dependency from the properties of the cpp file. please check C++->Precompiled header in the settings windows. Otherwise you just include "stdafx.h" in the beginning of the file.

    It's better if you could read the following link
    http://msdn2.microsoft.com/en-us/library/szfdksca(VS.71).aspx

    Thursday, December 13, 2007 8:15 AM