How to Build and Run a Code::Blocks Programming Project in C - dummies

How to Build and Run a Code::Blocks Programming Project in C

By Dan Gookin

To create a program in the Code::Blocks C integrated development environment, you must build the project. This single step does several things. If you’ve already started your first project, ex0101, and it’s open and displayed in Code::Blocks, you’re ready to build. Heed these steps:

  1. Ensure that the project you want to build is activated in the Management window.

    Activated projects appear in bold text. If you have more than one project shown in the Projects window, activate the one you want to work with by right-clicking the project name (by the Code::Blocks icon) and choosing the Activate Project command.

  2. Choose Build→Build from the menu.

    The Build Log tab in the Logs part of the window displays the results of building the project. You see a few lines of text.

Because you didn’t mess with the source code skeleton, the project compiles with no errors; you see the text within the summary that indicates zero errors and zero warnings. Good. When errors do appear, which is often, you go about fixing them. The error messages help in that regard.

Building a project is only half the job. The other half is running the project, which means executing the completed program from within the IDE.

To run the current project, choose Build→Run from the menu. You see the terminal window appear, listing the program’s output, plus some superfluous text.


Press the Enter key to close the command prompt window.

And now, for the shortcut: You can build and run a project using a single command: Choose Build→Build and Run.

  • The keyboard shortcuts for Build, Run, and Build and Run are Ctrl+F9, Ctrl+F10, and F9, respectively. No need to memorize those shortcuts — they’re listed on the menu.

  • Command buttons to build and run projects are found on the Compiler toolbar. You’ll find a yellow gear icon for Build, a green arrow for Run, and a combination of the two for the Build and Run command.

  • The program output appears in the top part of the command prompt window. The last two lines are generated by the IDE when the program is run.

    The text shows a value returned from the program to the operating system, a zero, and how long the program took to run (9 milliseconds). The Press any key to continue prompt means that you can press the Enter key to close the window.