Creating a new project

From Code::Blocks
Revision as of 22:34, 11 August 2011 by Alpha (talk | contribs) (Created page with "Category: User Documentation right '''This is a work in progress, and may be missing key details.''' Launch the Project Wizard through ''File->New...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
ProjectWizard.png

This is a work in progress, and may be missing key details.

Launch the Project Wizard through File->New->Project... to start a new project. Here there are many pre-configured templates for various types of projects, including the option to create custom templates. Select Console application, as this is the most common for general purposes, an click Go.

The console application wizard will appear next. Continue through the menus, selecting C++ when prompted for a language. In the next screen, give the project a name and type or select a destination folder. As seen below, Code::Blocks will generate the remaining entries from these two.

ConsoleApplication.png

SelectSource.png

Finally, the wizard will ask if this project should use the default compiler (normally GCC) and the two default builds: Debug and Release. All of these settings are fine. Press finish and and the project will be generated. The main window will turn gray, but that is not a problem, the source file needs only to be opened. In the Projects tab of the Management pane on the left expand the folders and double click on the source file main.cpp to open it in the editor. This file contains the following standard code.

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}

Adding additional files

A single source file is of little uses in programs of any useful complexity. In order to handle this, Code::Blocks has several very simple methods of adding additional files to the project.

Modifying build options