Article ID: 167349
Article Last Modified on 12/1/2003
APPLIES TO
- Microsoft Visual C++ 5.0 Enterprise Edition
- Microsoft Visual C++ 6.0 Enterprise Edition
- Microsoft Visual C++ 5.0 Professional Edition
- Microsoft Visual C++ 6.0 Professional Edition
- Microsoft Visual C++ 6.0 Standard Edition
This article was previously published under Q167349
SYMPTOMS
When you try to create a new class derived from a generic class using the New Class Wizard, you might get the following error message:
CAUSE
The New Class Wizard can only derive from classes explicitly included in the project. Classes that are only in the External Dependencies folder are not considered part of the project. That is, if the base class' header file, where the base class is declared, is not included in the project, the wizard cannot add the header to the derived class' header file.
RESOLUTION
To resolve the problem, you can do one of the following:
- Close the message box and derive the class anyway. Add the base class header file manually to the derived class' header file. -or-
- Add the base class header file to the project. On the Project menu, click Add To Project, and then select Files. Browse for the base class header file, then click OK. After doing this, you should be able to derive the class without any warning messages.
Once the new class has been derived, you may remove the base class file from the project, and it will appear in the External Dependencies folder on the next build.
STATUS
This behavior is by design.
MORE INFORMATION
The following procedures can be used to reproduce the problem.
Steps to Reproduce Behavior
- Use the AppWizard to generate a generic MFC application.
- Create a header file named CTestClass.h in which you declare a base class. Make sure CTestClass.h is not added to the project. Delete it from FileView if necessary.
- Derive a class from CTestClass. by clicking New Class on the Insert menu. In "Class type:" choose "Generic Class". Name the derived class CTestClassDerived. Enter CTestClass as the class name in the Derived From edit box.
- Click OK to save the derivation and exit the New Class dialog box.
- You should get the error message box mentioned previously before the dialog box is closed.
Additional query words: member methods wizards VwbIss
Keywords: kbide kbprb KB167349