Home

How to Configure the Library Project in C++

|
|  Updated:  
2016-06-27 14:02:15
C++ For Dummies
Explore Book
Buy On Amazon
The static library starts with a standard C file. To make this library work well with templates, you need to delete the C file, add a C++ file, and add a header file. The following steps describe how to perform this process:

Right-click main.c in the Projects tab of the Management window and choose Remove File From Project from the context menu that appears.

main.c in the Projects tab of the Management window and choose Remove File From Project from the context menu that appears.">

Code::Blocks removes the file from the project tree.

Choose File→New→File.

Choose File→New→File.

You see the New from Template dialog box shown.

Highlight the C/C++ Header icon and click Go.

You see the Welcome page of the C/C++ Header wizard.

Click Next.

Click Next.

The wizard asks you to provide the header configuration information.

In the Filename with Full Path field, type MathLibrary.h, click the ellipses button, and then click Save.

MathLibrary.h, click the ellipses button, and then click Save.">

Code::Blocks adds the complete project path to the filename you chose. Notice that Code::Blocks also supplies an entry for the Header Guard Word field. This word ensures that the header isn’t added more than once to a project.

Click All, and then click Finish.

The C/C++ Source wizard adds the file to your project. You’re ready to begin creating a template library.

About This Article

This article is from the book: 

About the book author:

John Paul Mueller is a freelance author and technical editor. He has writing in his blood, having produced 100 books and more than 600 articles to date. The topics range from networking to home security and from database management to heads-down programming. John has provided technical services to both Data Based Advisor and Coast Compute magazines.

Jeff Cogswell has been an application developer and trainer for 18 years, working with clients from startups to Fortune 500 companies. He has developed courses on C++ and other technologies.