0% found this document useful (0 votes)
47 views

EEE554 Lab Exercise1

This document provides instructions for completing Lab Exercise 1 which involves using the Code::Blocks IDE to create, compile, and run a "Hello World" C++ program. It describes Code::Blocks as a free, open-source C/C++ IDE that supports Windows, Linux, and Mac OS. Steps are provided to create a new empty file, save it as a C++ source file with a .cpp extension, and type the "Hello World" code. The document also explains how to compile the source code using the Build menu and run the compiled program.

Uploaded by

Rohs Prasad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

EEE554 Lab Exercise1

This document provides instructions for completing Lab Exercise 1 which involves using the Code::Blocks IDE to create, compile, and run a "Hello World" C++ program. It describes Code::Blocks as a free, open-source C/C++ IDE that supports Windows, Linux, and Mac OS. Steps are provided to create a new empty file, save it as a C++ source file with a .cpp extension, and type the "Hello World" code. The document also explains how to compile the source code using the Build menu and run the compiled program.

Uploaded by

Rohs Prasad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

EEE554 Lab Exercise1

Introduction to Code::Blocks
February 2, 2016

1 Lab Objectives
In this lab, you will practice:

1. Creating C++ source files using the Code::Blocks IDE

2. Editing, compiling and running a C++ program

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.

3. Click on the Save icon or go to File and click on Save 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.

5. Now you can type your C++ source code.

Create your very first C++ program, “Hello World” in Code::Blocks by typing the
following lines of code:

1
Figure 1: Code::Blocks IDE

1 # include < iostream >


2
3 using namespace std ;
4
5 int main ()
6 {
7 cout << " Hello World ! " << endl ;
8 }

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.

You might also like