How to Create Your First C++ Program - dummies

How to Create Your First C++ Program

By Stephen R. Davis

The first step to creating a C++ program is to create what is known as a project. A project tells Code::Blocks the names of the .CPP source files to include and what type of program to create. Most of the programs you learn at the beginning will consist of a single source file and will be command-line style:

  1. Start up the Code::Blocks tool.

  2. From within Code::Blocks, choose File→New→Project.

  3. Select the Console Application icon and then click Go.

  4. Select C++ as the language you want to use from the next dialog box. Click Next.

    Code::Blocks and gcc also support plain old C programs.

  5. In the Folder to Build Project In field, select the “…” icon.

  6. Click on Computer and then the C: drive on Windows.

    On Linux and Macintosh, you can select the Desktop.

  7. Select the Make New Folder button at the lower left of the screen.

  8. Name the new folder CPP_Programs_from_Book.

    The result should look like this figure.


  9. In the Project Title field, type the name of the project, in this case Conversion.

    The resulting screen is shown in the following figure on Windows. The Linux and Macintosh version look the same except for the path.


  10. Click Next.

    The next dialog box gives you the option of creating an application for testing or the final version. The default is fine.

  11. Click Finish to create the Conversion project.