This Tutorial Explains the Installation, Working and Features of Dev C++ IDE which is one of the Most Commonly used IDEs for Developing C++ Applications:
Dev-C++ is a fully featured graphical IDE (Integrated Development Environment) that uses the MinGw compiler system to create Windows as well as Console based C/C++ applications. It can also be used with any other GCC-based compiler like Cygwin.
Dev-C++ is free software and is distributed under the GNU General Public License. Thus we can distribute or modify the IDE freely. It was originally developed by “Bloodshed Software”. It has been forked by Orwell after it was abandoned by Bloodshed in 2006.
=> Check The Complete C++ FREE Training Series Here.
Let’s now discuss the various aspects of this C++ IDE in detail.
What You Will Learn:
Features Of Dev-C++ IDE
Enlisted below are some of the features of this IDE that help us develop efficient and user-friendly C/C++ applications.
- Dev-C++ supports GCC-based compilers including Cygwin, MinGW, etc. We can either install a dev-C++ IDE along with the compiler integrated or just an IDE if we already have a compiler on our system.
- We can use integrated debugging (using GDB) with this IDE. The debugger allows us to perform all the general debugging operations on source code.
- It has a localization feature that provides support for multiple languages. We can select the language the first time when we open the IDE after installing it. We can also change the language anytime using settings.
- Like the other IDEs, this IDE also provides the “Auto-Completion” feature for the code we write.
- It comes with customizable syntax highlighting editor that can make the source code more readable.
- Allows to Edit and compile the Resource files.
- Has a Tool Manager that contains various tools that can be used in the project.
- This IDE also has inbuilt Find and replace facilities.
- Using Dev-C++ IDE, we can create various types of applications be it Windows, Console, Static libraries or DLLs.
- We can also create our own project templates to create our own project types.
- Makefiles that are used for managing the build process for the application can also be created using dev-C++ IDE.
- It provides support for Class Browser as well as Debug variable Browser.
- It has a Project Manager that helps us to manage various projects.
- Also provides print support through its interface.
- We can easily install the add-on libraries using the package manager provided by the IDE.
- This C++ IDE also provides CVS support for source code management.
Installing And Configuring C++ IDE
We can get the appropriate installable for dev-C++ IDE from here
The source code link is also available here
Let’s see the entire installation process now. We have used the installable that comes along with the C++ compiler. In this tutorial, we use the dev-C++ version 5.11 with the TDM-GCC 4.9.2 compiler.
The stepwise installation for dev-C++ is given below.
#1) The first step while we start the installer is to select the language of our choice as shown in the below screenshot.
#2) Once you select the appropriate language, you have to agree to the license agreement that pop-ups next.
#3) Next, we are asked to select the components that we need to install as a part of the dev-C++ installation.
As shown in the above screenshot, we are provided with a list of components available for installation and a checkbox against each component. We can check/uncheck each box to indicate which components to install. Click next once the components are selected.
#4) Now the installer prompts the user for the destination folder where the dev-C++ files/libraries etc. are to be copied.
Once we provide the destination folder path, click on Install.
#5) The following screenshot shows the progress of the installation.
Once the installation is over, a “finish” dialog that signals the end of the installation appears. We click finish and then we can launch the dev-C++ IDE.
Now let’s see the working of this C++ IDE in detail.
Development Using Dev-C++ IDE
Configuring Dev C++
Change Linker Setting For Debugging
After starting the IDE, the first thing we need to ensure is the setting for debugging information to be generated.
Follow the steps below to set the debugging information.
- To change this setting, click on Tools -> Compiler Options.
- Then click on the “Settings” tab on the dialog that pops up.
- Under “Settings”, we have a “linker” tab.
- In the “linker” tab there are various options shown. Set “Yes” for the option “Generate Debugging Information (-g3)”.
This is shown in the following screenshot.
Click OK, once done.
Create A New Project
To create a new project in dev-C++ we need to follow the below steps:
- Click File -> New -> Project.
- A new dialog opens up as shown below.
- Here, we can specify the project name. Make sure to select the “Empty Project” and also to check the “C++ Project” button.
- Once the entire information is provided, we can click ok and the IDE will ask for the path where the project is to be saved. When this is done, a workspace will open with the project explorer on the left-hand side that shows the project we just created.
- Now we can add or import the code files into this project.
Add Source File(s)
Adding a file to a project can be done in two ways.
- Add a new file by clicking Project ->New File or Right-click on Project Name in the project explorer and click New File.
- Another way is to add the existing files to the project. This can be done by clicking Project ->Add to Project or right-click on Project Name in the project explorer and select “Add to Project…” This will give a dialog to select files and import them to the project.
- Once the files are added to the project, the workspace looks as shown below.
Compile/Build & Execute Project
When we have all the code ready for the project, we will now compile and build the project.
Follow the below steps to build and execute the dev C++ project:
- To compile the project, click Execute -> Compile (or click F9).
- We can see the compilation status in the “Compile Log” tab in the workspace.
- If there are any errors whether syntax or linker errors, then they will appear in the compiler tab.
- Once the project is compiled successfully, we need to run it.
- Click on Execute ->Run.( or click F10)
- The console window that gives us the output will be shown in the below screenshot.
- If there are command line parameters to be passed to the program, we click on Execute ->Parameters. This will open a dialog using which we can pass parameters.
Debugging In C++ IDE
Sometimes we may not get the desired output from our program although the program is syntactically correct. In such a situation, we can debug the program. The dev-C++ IDE provides the inbuilt debugger.
Follow the below steps to debug the program using Dev-C++ IDE:
- Click Execute ->Debug. (or click F5).
- Once the debug is clicked, we get the debug menu in the IDE, as shown below.
- Before debugging we can toggle breakpoints using F4 at a particular line of code.
- Using the debug menu, we can use options like add watches, run to cursor, into function, etc. to efficiently debug our program.
Frequently Asked Questions
Q #1) Is dev C++ free?
Answer: Yes. Dev-C++ is a free IDE.
Q #2) Does Dev C++ support C++11?
Answer: Yes. Actually, Dev-C++ is just an IDE. Actual compiling is done by the underlying GCC compiler that is associated with the IDE. Every GCC compiler uses the C++03 standard by default. To change it to C++ 11, we need to change the compiler option called language standards.
- To do this, click on Tools in Dev-C++ IDE.
- Next click on Compiler Options…
- Under this click the “Settings” tab.
- Inside the settings tab, we can see the “Code generation” tab.
- Click on the “Language Standard (-std)” value and set it to “ISOC++11” or “GNUC++11” as per your requirement.
The screenshot below will help in actually changing the option.
Click OK for the dialog, and the compiler standard is changed to C++ 11.
Q #3) Can dev-C++ compile C?
Answer: Yes. Dev-C++ IDE allows us to write and compile C and C++ programs. As C++ is an enhanced version of C language, the C++ compiler can compile any program written in C language.
In this IDE, while creating a new project, the dialog gives us the option to create a C or C++ project.
In this tutorial, we discussed the features, installation, and working of dev-C++ IDE in detail. We saw the entire cycle of creating a new project, adding source code files, compiling, building and executing steps in detail.
We also discussed the debugging process in Dev-C++ along with some of the frequently asked questions. This can be considered the popular IDE for C++ development after Visual Studio and Eclipse IDE.
We will explore many more topics that are important from the programmer’s point of view in our subsequent tutorials.
=> See Here To Explore The Full C++ Tutorials list.