Microsoft KB Archive/192629

= FIX: ClassView Cannot Add Member Functions To Template Classes =

Article ID: 192629

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 Q192629



SYMPTOMS
The following error occurs when trying to add member functions to template classes using ClassView:

Unable to create the implementation of this function



RESOLUTION
To add member functions to a template class, you must manually enter the functions into the source files.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

This problem was corrected in Microsoft Visual C++ .NET.



Steps to Reproduce Behavior
 Create a default MFC AppWizard (exe). Add a generic class to the project:

 Select the project in ClassView. Right-click the mouse and select New Class. Select Generic from the Class Type combo box. Give the class a name, such as CMyGenericClass, and click OK.</li></ol> </li>  Edit this generic class declaration, constructor definition, and destructor definition by adding the template keyword along with the type list, for example: //generic class declaration:

template class CMyGenericClass { public: CMyGenericClass; virtual ~CMyGenericClass; };

//constructor and destructor definitions:

template CMyGenericClass<c>::CMyGenericClass {     }

template CMyGenericClass<c>::~CMyGenericClass {     }                        </li> In ClassView, right-click CMyGenericClass and select "Add Member Function."</li> Enter the function name and return type. Click OK. A dialog box is displayed indicating the following error:

Unable to create the implementation of this function

</li></ol>

In Visual C++ 6.0, you do not have the ability to jump to a template function declaration from ClassView unless the template function is defined inside the class declaration (inline).

For additional information, please see the following article in the Microsoft Knowledge Base:

154112 ClassView Cannot Find Template Member Function Definition

Additional query words: kbDSupport

Keywords: kbbug kbfix kbnoupdate kbide kbclassview KB192629

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.