Click to See Complete Forum and Search --> : Adding class to the class wizard


Steve McNeese
April 7th, 1999, 10:54 AM
I have a class that I add the .cpp and .h files to my project. I want to derrive a new class from that class using the class wizard. How can i get that class to show as a base class in the class wizard on the add new class dialog?

Thanks,

Steve

Steven M. McNeese
steven.mcneese@boeing.com

April 7th, 1999, 11:15 AM
You cant. You simply choose "Generic class" and manually add the #include directive for the header file in the newly created class' header file.
Mind you that this is also the procedure if you want your class to derive from CObject, because CObject is not listed in the combobox - just as a lot of other MFC classes.

Steve McNeese
April 7th, 1999, 11:36 AM
I did that, but now I am getting link errors. I modified the .h file of the newly created class and changed the class CNewClass : public CWnd to class CNewClass : public COldClass. I also added the header file for the oldclass to the header file of the new class. What am I missing?


Steven M. McNeese
steven.mcneese@boeing.com

April 7th, 1999, 01:48 PM
You're using VC6, aren't you? I've noticed this strange new behavior too. When you add a CPP and H file to a project, and do a build, it (of course) compiles the new CPP and H file, but won't link. It's as if the compiler created the OBJ file, but the linked doesn't know to add it in yet. Very strange.

But the fix is easy. Instead of doing an "F7" build, do a "Ctrl-F7" compile of the new CPP file. Then do a normal "F7" build. You only have to do that once per new CPP file, and I have no idea why it is necessary.