Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 21: Tree and List Controls


create a link to it. The project can be a console application, a Win32 or an MFC
application. The library file has the lib extension.

22.2.2 Creation of a Static Library


To create a static library, you can open the New Project dialog box and select Win32
Project as the type of application. In the Win32 Application Wizard, select the Static
Library radio button in the Application Type section. The following options are also
available:

??If you do not check the Precompiled Header option, an empty project would be
created for you
??If you check the Precompiled Header option, the wizard would generate a StdAfx.h
header file and a StdAfx.cpp source file for the project. This allows you to include
common header files in StdAfx.h and omit those common header files in every file
of the project. When necessary, the compiler would retrieve the needed header file
from StdAfx.h

After laying the foundation of a static library, you can add functions, classes, and/or
resources that will be part of the library.

Practical Learning: Creating a Static Library



  1. Start Microsoft Visual Studio if necessary and display the New Project dialog box

  2. In the Project Types list, make sure you select the Visual C++ Projects node. In the
    Templates list, click Win32 Project. In the Name edit box, replace the content with
    BusMath

  3. Click OK

  4. In the Win32 Application Wizard, click Application Settings. In the Application
    Type section, click Static Library

Free download pdf