EEE554 Lab Exercise1
EEE554 Lab Exercise1
Introduction to Code::Blocks
February 2, 2016
1 Lab Objectives
In this lab, you will practice:
2 Code::Blocks
Code::Blocks is a free, open-source, C, C++ and Fortran IDE built to meet the most
demanding needs of its users. It supports many platforms such as Windows, Linux and
Mac OS. It is designed to be very extensible and fully configurable. It is an IDE with all
the features, having a consistent look, feel and operation across platforms. Fig. 1 shows
the screen-shot of Code:Blocks IDE.
2.1 Instructions
The following steps must be followed to create a C++ source file using Code::Blocks.
These steps must be followed for all your future labs and assignments.
1. Go to File and select New and select Empty File from the list
2. An “Untitled” page will be added to the Code::Blocks IDE. The next step is to save
the “Untitled” page as a C++ source file.
4. A dialog box will appear. Select the path to save in and type the file name. You
have to type in the full file name with the extension. For example lab01.cpp. Note
that .cpp is the C++ source file name extension. After typing the full file name
click on Save to create the C++ source file.
Create your very first C++ program, “Hello World” in Code::Blocks by typing the
following lines of code:
1
Figure 1: Code::Blocks IDE
After creating/editing your C++ source file, you can proceed to compile the source
file and to run the compiled version of your program. To compile go to Build on the
menu bar and select Build. The build log at the bottom of the IDE will show whether
your program has compiled successfully. If there are any errors, the build log will display
the line number where there is an error. You need to correct the error if the build log
displays errors in your program. If there is no error in your source file, the build log will
display that there are no errors in your program. You can go ahead to run your compiled
program by going to Build and clicking on Run.