C++ Notes: IDEs - Dev-C++

Dev-C++ is a reasonably good, simple, free C++ development environment for C++. It provides a GUI interface to gcc (GNU Compiler Collection). I use it rather than the Microsoft's Visual Studio or Borland's C++ Builder because of its simplicity. For small programs it's a good choice. For larger and more complex programs, the commercial products offer more.

Where to get it

www.bloodshed.net has links for downloading. By default it installs itself in C:\Dev-Cpp. You should uninstall the previous version before installing the new version.


If they aren't already set, you consider setting these options [applies to Dev-C++ -].

Tools > Editor options
A number of editor options that are worth setting if they aren't already turned on. Some are set on by default (Auto Indent, Insert Mode, Find Text at Cursor, Scrollbars as needed, Use Syntax highlighting). Be sure that your tab size is set to 4 (or less). Turn on the Highlight matching braces/parentheses option. When this is turned on, selecting a brace will show the matching brace, saving a lot of time when trying understand exactly what's wrong with your braces. In the editor options Display tab, select the Line Numbers option so that numbers will show on your source code.
Tools > Compiler Options > Settings [tab] > Code Generation [list item]
Set Enable exception handling to Yes. If you use asserts, it may be necessary to set this option even to get your program to compile.
Tools > Compiler Options > Directories [tab] > C++ Includes [tab]
Some installations don't have all the C++ Libraries included. For version I show the following, altho I'm not really sure what the implications of all of them are.
If one is missing, the button to the right of the textfield can be used to browse for new directories.

Projects are useful for managing multiple source files

A project (contained in a .dev file) is how Dev-C++ (and other IDEs) keep track of multiple source files. If you have only one source file, there is no need to create a project.

Console window closes when program terminates

This isn't really a bug; it's probably what should happen normally, but it would be nice to have an option to keep it open as some IDEs do. Here are some ways of handing this.

  1. system("PAUSE"). Put the following statement before the return 0 in main.
    This will cause the window to remain open until you hit any key.
  2. Extra final read. Put an extra read immediately before the return. Just ignore the input and return, but this stops the window from disappearing until there is input.
  3. Console window. Open a command/console/DOS window, cd to the appropriate directory, and run the program "by hand" by typing the name of the .exe file.
  4. Breakpoint. Set a breakpoint on the return statement at the end of main. To use the debugger: