0% found this document useful (0 votes)
44 views9 pages

PF Lab 1

Dev-C++ is a free integrated development environment for C/C++ programming that runs on Windows. It allows users to edit, compile, link, and debug C/C++ programs. The tutorial outlines the basic steps for using Dev-C++: creating a project, writing source code, compiling and linking the code, executing the program, and debugging any errors. Key features of Dev-C++ include a source code editor, project explorer, and results window to display compilation output.

Uploaded by

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

PF Lab 1

Dev-C++ is a free integrated development environment for C/C++ programming that runs on Windows. It allows users to edit, compile, link, and debug C/C++ programs. The tutorial outlines the basic steps for using Dev-C++: creating a project, writing source code, compiling and linking the code, executing the program, and debugging any errors. Key features of Dev-C++ include a source code editor, project explorer, and results window to display compilation output.

Uploaded by

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

LAB 1 – INTROUDCTION TO DEV C++ IDE

Dev-C++ is a full-featured Integrated Development Environment (IDE) for the C/C++


programming language. As similar IDEs, it offers to the programmer a simple and unified tool to
edit, compile, link, and debug programs. It also provides support for the management of the files
of a program in “projects” containing all the elements required to produce a final executable
program.

Dev-C++ is a Free Software distributed under the terms of the GNU General Public License
(GPL). The IDE can be downloaded here:
https://bloodshed-dev-c.en.softonic.com/download
Dev-C++ can be installed on any Windows machine with Windows XP/7/8/10. This tutorial uses
Dev-C++ 5.11 on Windows 10 (configuration in the computer labs as of course 2016-2017). For
the sake of simplicity, use the default installation options in your home computer.

The application development process encompasses the following steps:

1. Create a project/source file


The type of application and the programming language to be used are specified.
2. Write source code
Write the program in C++ and save the source code file.
3. Compile and link the code
The source code is compiled and linked to generate a running program. Other files of the
project may be created if required.
4. Fix compilation errors, if any
If the syntax of the program is not correct, the compilation fails and the compiler
generates a message related to the error/s. The programmer must correct the errors.
5. Run the program
Run the program to validate the functioning.
6. Fix execution errors, if any
If the actions performed by the program are not as expected, it is necessary to correct the
source code. It may be also convenient to use the debugger to find complex errors.
Start Dev C++

Start the IDE from the Program folder Dev-C++ or Bloodshed Dev-C++.

Figure 1. Running Dev-C++ in the computer lab

Create a Source File


The source code will be written in a file called source code file. It is necessary to create a source
code file by using menu (File > New > Source File).
Figure 2. Creating new source code file
The IDE generates a basic source code file (by default, Untitled1.cpp). These files are not saved
in the project folder until the programmer saves or compiles the program (see below).

File
Source Code Editor
Explorer

Results Window

Figure 3. Three sub windows in IDE

The IDE window includes three sub-windows: the Project Files Explorer, the Result Tabs, and
the Source Code Editor. These windows can be resized and minimized.

The Files Explorer window shows the name of the project and the included files. The Project
tab usually contains a single file with the source code of the program. In this pane, we can find
two additional tabs: Classes and Debug. Classes tab shows the functions of the program.
Debug tab shows watched variables in the debugging process.

The Results window is used to present the results of the actions of the IDE: compilation errors,
compiling directives, debugging commands, etc.

Writing Source Code

Once the Source File has been created, we can start writing our C++ program.

It is recommended to use the classic color configuration of the editor (Tools > Editor Options
> Syntax > Color Speed Settings > Classic) and to activate the support for opening and closing
brackets (Tools > Editor options > General > Highlight matching braces / parenthesis).

The editor highlights with different colors keywords and other elements of the C++ language.
The classic scheme uses:

 Light blue for comments


 Green for included libraries
 Red for text strings
 Bold black for C++ keywords

For instance, the HelloWorld program is shown as follows:

Figure 4. The HelloWorld program

Compilation and Link

To run a program, the source code must be compiled and linked. Dev-C++ performs the
complete process by clicking the Compile button or from menu (Execute > Compile or
pressing F9 key).
Compile Button

Figure 5. Compiling the source code

The editor displays the File Save Dialogue Box to save the file before compilation and execution
as shown.
Figure 6. Save the source code file

Select appropriate folder and specify the filename. Then click Save to store the file permanently
on the local drive. Once the compilation process is finished successfully the log will be displayed
in Results Window as shown.

Figure 7. Compilation successful as shown in Compile Log window


Execute the Program

Then execute/run the program by clicking Run button or from menu (Execute > Run or
pressing F10 key).

Figure 8. Executing the program

It is possible to compile and run the program in a single step by clicking Compile & Run
button or from menu (Execute > Compile & Run or pressing F11 key).
Figure 9. Compile and Run in one-step

Assuming you did not make any syntax errors on your code, you should see a similar output
window running your program.

Figure
10. Displaying the output window

You might also like