C++ All-in-One For Dummies
Book image
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.

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.

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 Mueller has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services (AWS). Luca Massaron, a Google Developer Expert (GDE),??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques.

This article can be found in the category: