Advanced OOP using C++

Installing and Running BloodshedSoftware's Dev-C++

Published:  July 30, 2008
By Richard G. Baldwin

File:  AdvCpp00115



Many different C++ programming tools are available and can be used to compile and execute the C++ programs in these lessons.  In an attempt to be platform independent, I will mostly use a product named Dev-C++ from BloodshedSoftware.  The purpose of this short lesson is to provide instructions for installing, testing, and using Dev-C++ on a Windows XP system.

Viewing tip

I recommend that you open another copy of this document in a separate browser window and use the following links to easily find and view the listings while you are reading about them.


Supplementary material

I recommend that you also study the other lessons in my extensive collection of online programming tutorials.  You will find a consolidated index at

Dev-C++ download and installation instructions

At that point, the software should be installed and ready for use.

Dev-C++ usage and test instructions

These instructions apply only to those situations in which the program consists of a single file.  I will provide additional instructions later for multi-file projects.

Start Dev-C++ running

Go to the Start menu and select All Programs.  You should find an entry that reads Bloodshed Dev-C++ or something similar.   Click Dev-C++ to start the Dev-C++ IDE running.

Create a new source-code file

Select File/New/Source File to open the editor.

Enter the code shown in Listing 1 into the editor and save the file as HelloWorld01.cpp.

Listing 1. Source code for HelloWorld01.cpp.
//File HelloWorld01.cpp
using namespace std;

int main(){
  cout << "Hello World\n";
  return 0;
}//end main

Compile and execute the program

Select Execute/Compile & Run to compile and execute the program.

If Dev-C++ was installed correctly, you should see a command-line screen open and close very rapidly.  In fact, it should open and close so rapidly that you can't read it.

You should also find a file in the current directory named HelloWorld01.exe.  If you double click that file, you should also see a command-line screen flash by very quickly.

Executing from a command line

However, if you first open a command-line screen and execute the file named HelloWorld01.exe from the command line, the words Hello World should appear on the screen as the output from the program.

Forcing the command-line screen to remain open

Often when writing code that produces output on the command-line screen, we would like to either execute the program from within the Dev-C++ IDE or execute it by double clicking the exe file.  By disabling the return statement and adding the two lines of code shown by the boldface statements in Listing 2, you can force the command-line screen to remain open long enough for you to view the contents of that screen.

Listing 2. Source code for HelloWorld02.cpp.
//File HelloWorld02.cpp
using namespace std;

int main(){
  cout << "Hello World\n";
  //  return 0;
  //Following statements cause Dev-C++ output to remain
  // on the screen
  return EXIT_SUCCESS;
}//end main

The user interface is straightforward

The user interface for the Dev-C++ IDE is relatively straightforward.  Therefore, other than the need for the special code shown in Listing 2, you should have no difficulty creating, compiling, and executing C++ programs that consist of a single file using Dev-C++.  As mentioned earlier, I will provide instructions for creating, compiling, and executing multi-file projects later in this series of tutorial lessons.


Copyright 2008, Richard G. Baldwin.  Reproduction in whole or in part in any form or medium without express written permission from Richard Baldwin is prohibited.

About the author

Richard Baldwin is a college professor (at Austin Community College in Austin, TX) and private consultant whose primary focus is a combination of Java, C#, and XML. In addition to the many platform and/or language independent benefits of Java and C# applications, he believes that a combination of Java, C#, and XML will become the primary driving force in the delivery of structured information on the Web.

Richard has participated in numerous consulting projects and he frequently provides onsite training at the high-tech companies located in and around Austin, Texas.  He is the author of Baldwin's Programming Tutorials, which have gained a worldwide following among experienced and aspiring programmers. He has also published articles in JavaPro magazine.

In addition to his programming expertise, Richard has many years of practical experience in Digital Signal Processing (DSP).  His first job after he earned his Bachelor's degree was doing DSP in the Seismic Research Department of Texas Instruments.  (TI is still a world leader in DSP.)  In the following years, he applied his programming and DSP expertise to other interesting areas including sonar and underwater acoustics.

Richard holds an MSEE degree from Southern Methodist University and has many years of experience in the application of computer technology to real-world problems.