Dev-C++

Introduction

Dev-C++ is a free integrated development environment (IDE) for developing C/C++ programs. It is distributed under the GPL and uses MinGW and GDB as its compilation and debugging systems. Dev-C++ runs on Microsoft Windows.

Dev-C++ has a simple and friendly interface, is easy to install, and supports single-file compilation, so it has become the first choice for many beginner OI contestants and C++ beginners. In NOIP, provinces that provide Windows as the competition system generally preinstall Dev-C++.

Dev-C++ originated from Bloodshed Dev-C++, written by Colin Laplace. This version stopped being updated on February 22, 2005. In 2006, Colin Laplace, the main developer of Dev-C++, once explained this: "Because I was busy with matters in real life, I did not have time to continue developing Dev-C++."

Orwell Dev-C++ is a derivative version of Dev-C++, developed and maintained by the independent programmer Orwell (Johan Mes). It fixed bugs in the original Dev-C++ and updated the compiler version. Generally speaking, Dev-C++ 5.x refers to Orwell Dev-C++. Its last update was in 2015, version 5.11.

Embarcadero Dev-C++1 is the successor to Bloodshed Dev-C++ and Orwell Dev-C++. In 2020, Embarcadero sponsored and took over the original Dev-C++ project and continued its development. Embarcadero Dev-C++ added support for high DPI, updated the compiler to support newer versions of the C++ standard, and added dark mode.

The above Dev-C++ distributions are all considered "official". In addition, after Orwell Dev-C++ stopped being updated in 2015, an individual developer from China named royqh1979 decided, for teaching purposes, to continue developing his personal branch of Dev-C++, naming it Red Panda Dev-C++2. It integrates code completion and a newer version of MinGW64, making it very convenient for personal use and learning in China.

After the release of Red Panda Dev-C++ version 6.7.5, the author used qt5 to develop the brand-new Red Panda C++3, which can run natively on systems such as windows, linux, and macos. Red Panda C++ has an interface similar to Dev-C++. Besides providing more complete versions of functions similar to Dev-C++—such as single-file compilation, debugging, syntax highlighting, and search/replace—it also provides basic functions common in modern IDEs, such as dark themes, code completion, variable/function renaming, and switching/automatic detection of file encoding. In addition, Red Panda C++ has a problem-set feature similar to CP Editor: you can write problem sets yourself or download sample problems from common OJ contest websites, and automatically run and test programs.

User Guide

Common Shortcuts

Files

  • Ctrl + N: Create source code
  • Ctrl + O: Open a file
  • Ctrl + W: Close a file
  • Ctrl + Shift + W: Close all files
  • Ctrl + P: Print a file

Formatting

  • Ctrl + /: Comment and uncomment
  • Tab: Indent
  • Shift + Tab: Unindent

Line Operations

  • Ctrl + E: Duplicate a line
  • Ctrl + D: Delete a line
  • Ctrl + Shift + Up: Move upward
  • Ctrl + Shift + Down: Move downward
  • Ctrl + F: Search
  • Ctrl + R: Replace
  • F3: Find next
  • Shift + F3: Find previous
  • Ctrl + G: Go to a specified line number
  • Shift + Ctrl + G: Go to a specified function
  • Ctrl + [1 ~ 9]: Set a bookmark
  • Alt + [1 ~ 9]: Jump to a bookmark

Display

  • Ctrl + 滚轮: Increase or decrease the font size
  • Ctrl + F11: Enter or exit full screen

Running

  • F9: Compile only
  • F10: Run only
  • F11: Compile and run
  • F12: Recompile everything

Debugging

  • F2: Go to a breakpoint
  • F4: Set or remove a breakpoint
  • F5: Run under the debugger
  • F6: Stop
  • F7: Step through

Debugging Procedure

  1. Set the compiler configuration to TDM-GCC 4.9.2 64-bit Debug.
  2. Press F4 to set or remove a debugging breakpoint.
  3. Place the cursor on a variable and press Alt + A to add the watched variable to the debugging window.
  4. Press F5 to start debugging.
  5. Press F7 or Alt + N to step through the program.
  6. Press Alt + S to jump to the next debugging breakpoint.
  7. Press F6 to stop debugging.

Extensions

Adding Compilation Options

Click Tools -> Compiler Options, then select the "Code Generation/Optimization" tab. Several compilation options commonly used by the author are introduced below.

Enabling Optimization

Optimize code execution time or occupied space.

Select the "Optimization level (-Ox)" option under the "Code Generation" sub-tab.

Figure: Dev C++ 11

Changing the Language Standard

Use new language features or try to compile code under an old standard.

Select the "Language standard (-std)" option under the "Code Generation" sub-tab.

Figure: Dev C++ 12

Displaying the Maximum Number of Warnings

A small assistant for finding errors.

Select the "Show the most warning messages (-Wall)" option under the "Code Warnings" sub-tab.

Figure: Dev C++ 13

Generating Debug Information

This feature needs to be enabled when the message "The project has no debugging information. Do you want to open the project debugging options and rebuild it?" is displayed, clicking it causes a crash, or you want to use debugging functions.

Select the "Generate debugging information" option under the "Linker" sub-tab.

Figure: Dev C++ 14

Compilation Tricks

Click Tools -> Compiler Options, then select the "Compiler" tab. Several common tricks are introduced below.

Increasing the Stack Size

Prevent situations such as DFS overflowing the system stack.

Add the command -Wl,--stack=128000000 under "Add the following commands to the linker command line".

This command increases the stack to approximately 128 MB; increase it as needed.

Figure: Dev C++ 15

Defining Macros

Convenient for using file input/output in local testing or other purposes.

Add the command -D[String] under "Add the following commands to the linker command line".

Replace [String] with the macro name you need.

As shown in the figure, after enabling the compilation option, the following code can read data from the test.in file and output it to the test.out file.

Figure: Dev C++ 16
#ifdef LOCAL
freopen("test.in", "r", stdin);
freopen("test.out", "w", stdout);
#endif

Code Formatting

Click Astyle-> Format Current File or press Ctrl+Shift+A to format the code.

Figure: Dev C++ 17

Beautification

Fonts

Click Tools -> Editor Options, then select the "Display" tab.

Figure: Dev C++ 9

Themes

Click Tools -> Editor Options, then select the "Syntax" tab. You can use a preset theme or adjust it yourself.

Figure: Dev C++ 10

References

Footnotes

  1. The project's source code is hosted on GitHub and SourceForge. ↩

  2. The source code is hosted on Github ↩

  3. The project's official website is Red Panda C++, and its source code is hosted on Github ↩

This content comes from OI Wiki: Dev-C++. See the original for authors and revision history. AIOJ has adapted the formatting, in-site links, and resource paths.

Content is shared under CC BY-SA 4.0 and SATA license; additional terms are governed by the original notice. Thanks to the OI Wiki authors and contributors; per the SATA terms, please visit the OI Wiki repository and star it to show your support.