Getting started with Dev-C++
Dev-C++ is a free integrated development environment (IDE) for C and C++, and is distributed under the GNU General Public License. The IDE was written primarily for Microsoft Windows, althougth a Linux-based version is in development. The original developers, Bloodshed Software, ceased active involvement in the project in 2005. The example programs included in these pages were compiled using the version of Dev-C++ first developed by Orwell (Johan Mes) in 2011. The current version is 5.11, released in April 2015, which can be downloaded here.
- Download the Dev-C++ installation file using the link above.
- Double-click on the file to start the installation process.
- Click on I Agree to accept the license agreement.
- Click on Next to install the default features.
- Click on Install to accept the default installation location.
- The installation program will extract the necessary files . . .
- . . . and complete the setup procedure. Click on Finish.
- Choose your language (English is selected by default) and click on Next.
- Click on Next to accept the default theme.
- The installation program will confirm that Dev-C++ has been configured successfully. Click on OK to continue.
- The Dev-C++ IDE will open.
If you are runing the Dev-C++ IDE on a Windows computer, when you create a new project it will be saved in your "my Documents" folder. You may well wish to create a dedicated folder to hold your C projects. To do this, proceed as follows:
- Select Environment Options from the Tools menu.
- Select the Directories tab and browse to the directory in which you wish to store your projects (note: if the directory does not exist you will need to create it before you can select it - we created the Dev-C++ Projects directory as a subdirectory of the Documents folder).
To check that everything is working, we'll create a project called MyFirstProject and write a simple "hello World!" type program. Before we do, however, we need to create a subdirectory of our Dev-C++ Projects directory called MyFirstProject to hold our project files.
- Select New ► Project from the File menu.
- In the New Project dialog box, select the Console Application icon and make sure the C++ Project radio button is selected. Type "MyFirstProject" in the Name box, and click on OK.
- The project file must be saved before you can proceed (the project file name will be MyFirstProject.dev by default). In the Save As dialog box, change directory to the project subdirectory MyFirstProject, which you should have already created for this project (if you have not already created this subdirectory, you can do so on the fly by right clicking on a blank area of the Save As dialog box and selecting New ► Folder).
- You should now see something like the following screenshot.
- Delete the default program code, then copy and paste the following code into the code editor window:
// A first C++ program
using namespace std;
int main ()
cout << "Greetings, Maestro!";
cout << "\n\nPress ENTER to continue.";
getline( cin, s );
- Select Run from the Execute menu (or press the F10 key)
- You will be asked if you want to compile the program. Click on Yes to compile and run the program.
- You will now be asked to save the C++ source file. For now, accept the default file name (probably "main.cpp") and click Save.
- You should see the following output appear in a DOS command window.
If you run the program from within the Dev-C++ IDE, pressing the ENTER key once will cause a status message to me displayed in the DOS command window. Any further keypress will close the DOS command window. If you run the executable outside of the IDE (for example, by double clicking on the executable file in the project folder using Windows Explorer), the program will terminate immediately when the ENTER key is pressed.
If you run the program from within the IDE, pressing ENTER once generates a status message.
Most of the sample programs in these pages will require a single source file. From this point forward we leave it up to the reader to choose how they name and organise their projects, but we would recommend creating a new project folder for each new program as a matter of good housekeeping.