Integrated Templates
wxDev-C++ uses a template system to allow the user to more easily create specific projects. By this point you've encountered templates without knowing it. When you select File, New, Project on the IDE menu, the project type options listed in the dialog box (e.g. Console application, wxWidgets frame, etc.) are preset templates.Templates usually include two components:
- A set of source files - These source files contains the minimal amount of code needed to build the application
- Project file - A preset project file (extension .dev) containing all of the compiler and linker options necessary to build the application.
Templates\2-ConsoleApp.dev |
[Template] [Project]
|
The template above sets up a generic console project (i.e. a DOS shell application). In the
[Project]
section, one source code unit and
two compiler profiles are
defined. The source code unit is further specified as
consisting of a C++ skeleton code which is derived from the file consoleapp_cpp.txt
and renamed as file main.cpp
. The two
profiles are further specified as a MingW gcc and a MS VC++
2005 compiler profile.Using a text editor, you can easily create your own templates for use with wxDev-C++. However, wxDev-C++ can also automatically create templates for you based on your existing projects. For example, let's say that you frequently like to use the Boost, wxWidgets, and SQLite libraries in your projects. You'd like to create a Boost/wx/Lite (let's call it "BWL") template that sets up all of the includes, switches, and base code so that whenever you create a new project, you can have the template handle the basic setup and jump right into the main programming. Here's how to create your BWL template:
- Create the most basic project you can that correctly compiles, links, and executes using the Boost, wxWidgets, and SQLite libraries.
- On the File menu select New and then Template. A new template window appears.
- In the Template Info tab, you can specify the name, description, type, and icons associated with this template.
- In the Files tab, you can select which files of the current project you want to include in the template. Whenever you create new projects with this template, those files (and their contents) will be generated in the new project.
- In the Extras tab, you can specify extra compiler and linker switches/parameters that you wish to include in the template for new projects.
To test your new template, close the current project and try to create a new project (File, New, Project). Your BWL template should appear as an option in the list and can be used like any other.