Adding the Template Collection Classes to Scribble

Scribble uses two of several C++ collection template classes provided by MFC: CTypedPtrList and CArray. You’ve just added the code that uses CTypedPtrList; you’ll add the code that uses CArray when you declare the CStroke class.

All the template collection classes are defined in the header file, AfxTempl.h. This MFC-provided header file will not change over the course of your development of the Scribble application, so add it to Scribble’s precompiled header, StdAfx.h.

StdAfx.h was created by AppWizard to keep the list of header files to be precompiled. It consists of a list of #include statements, followed by the names of the header files.

Note   Precompiled header (PCH) files speed up build times because they don’t require recompiling.

To add AfxTempl.h to the precompiled header

  1. Switch to FileView and, if necessary, expand the Scribble project folder.

  2. Expand the Header Files folder, and open file StdAfx.h.

  3. At the end of the file, type:
    #include <afxtempl.h>    // MFC templates
    
  4. Save StdAfx.h.