Lab #1. Working with IDE Code::Blocks

Software is typically been developed using a specific development environment. We use Code::Blocks.

  1. Launch Code::Blocks
  2. Open file lab1.1.cpp

3.      Choose <Build>/<Build> or press button <Build> , or Ctrl+F9

4.      Wait for successful compilation status in “Build log” (in bottom part of the screen).
If no section “Logs & others” observed, press F2 to switch it on (press F2 again to switch it off).
To get rid of management pane in the left, press Shift+F2.

5.      Choose <Build>/<Run> or press button <Run> , or Ctrl+F10

6.      “Hello, world!” appears.

Up to now we simply took a single C++ file and compiled and ran it. In general, a C++ program can consist of several (many) files, and a common way to organize this all, a notion ‘project’ (or something similar) is used in most of IDEs (integrated development environments). Here we will create a project of one file just to illustrate the mechanism.

7.      Open “lab1.1.cpp”

8.      Choose <File>/<New>/<Project>

9.      In window “New from template” choose the project type “Console Application”; then „Go”; then “Next”.

10.  Project language will be „C++”; then „Next”

11.  Enter name of the project (say, “lab1”) and choose the directory of the project; then “Next”

By default, Code::Blocks offers a new subdirectory „lab1”, but we can control this in field “Resulting filename”:

12.  This can be skipped if seen, „Next”

13.  Here we simply press „Finish”

14.  Code::Blocks automatically creates file main.cpp and adds it to the project; but what we want is to get lab1.1.cpp included in the project.

15.  In the “Projects” pane choose main.cpp and right click “Remove from project”.

16.  Then left click „Add files” and choose lab1.1.cpp:

17.  Now we have the project lab1 with the file lab1.1.cpp in it; and we run it:

18.  Look at the working directory for additional directories automatically created with the project. We could also get without these additional directories by having specified it:

Instead of:

we could have (working (sub)directories specified empty).

For a project which is already created, this can be modified via “Project/Properties/Build targets”.