Dev C Debug

Courses‎ > ‎OOP 2008‎ > ‎Links‎ > ‎

How to debug in Dev-c++

You can use the Dev-c++ debugger to help you find errors in your program. In debug mode, you can step through the execution of your program one line at a time. Also, you can stop at any time to see the value of your variables. Here's how:
1) Normally, you can debug your program just by clicking the icon that looks like this:
2) Somtetimes, you see a message that says 'Your project does not have debugging information, do you want to enable debugging and rebuild your project?' If this message continues to appear even after you click 'yes' several times then you can do the following: Click Tools->Compiler Options. Then add '-g' as shown below:


3) To make your program stop at a certain line in your code, add a breakpoint at that line by clicking in the space on the left of your code:


4) Now when you click the debug icon your program will stop at the line you marked as a breakpoint.
5) To step through your code one line at a time, click your cursor on a line in your code where you think you have an error, click 'run to cursor', then use this:


6) At any time, you can see the value of your variables using the 'watch variables' function:
7) After you have selected 'Watch Variables' you can hover your mouse over any variable name in your code. Rest your mouse over the variable name for a few seconds and then you will see the variable and its value appear on the left side under the 'debug' tab:




Gourav Goyal

Download original Dev-C 5. Dev-C 5.0 (4.9.9.2) with Mingw/GCC 3.4.2 compiler and GDB 5.2.1 debugger (9.0 MB) Supports Windows 98, NT, 2000, XP. First, make sure you are using a project. Then go to Project Options - Compiler - Linker and set Generate debugging information to 'yes', and make sure you are not using any optimization options (they're not good for debug mode). Also check the Parameters tab, make sure you don't have any optimization options (like -O2 or -O3, but. The Dev-C reference on the debugger is really incomplete, or at least not well ordered. Anyways, I couldn't get much out of it. I played around a bit with the debugger, and I now understand how to pause the program at a breakpoint and watch values of variables, wich is pretty much the first part of the debugger. Dev C How To Skip While Loops Debugger If it doesn't get stuck this way, get it stuck the usual way and then attach the debugger to it and do the same stuff as above. Powered by Create your own unique website with customizable templates. Programming with the Dev C IDE 1 Introduction to the IDE Dev-C is a full-featured Integrated Development Environment (IDE) for the C/C programming language. As similar IDEs, it offers to the programmer a simple and unified tool to edit, compile, link, and debug programs. It also provides support for the management of the.

By the end of this short guide, you’d be able to run, debug, and get IntelliSense for C/C++ files in VSCode. Though, this guide is focused on the Windows platform but can be extended to Mac and Linux with some minor changes.

I extensively used C & C++ in my competitive programmingyears and wanted better support for debugging & IntelliSense. The only options availablewere Dev-C++ (outdated) and the original 'Mammoth'Visual Studio. Lately, I found VSCode and fell in love with it (first love was Atom).I tweaked it around and set it up as a complete IDE For small C, C++ projects especiallygeared towards competitive programming.

Create a sample C/C++ project

  1. Open/Create an empty folder in VSCode.
  2. Create a new.cpp file inside it like below:
new.cpp
  1. Install recommended C/C++ extension in VSCode and reload.

Install C/C++ Compiler

Dev C Debug

C/C++ extension does not include a C++ compiler. So, you will need to install one or use which is already installed on your computer.

Windows: Download MinGW64.zip (latest release) and extract it to the C Drive.

Dev C++ Debugger

Mac:XCode

Linux:GCC

Also, Make sure to add C++ compiler PATH to environment variable of your platform. For Windows MinGW64 add: C:MinGW64bin

Run and Debug C/C++ Code

Dev c++ debug

You’ll notice that there is also a .vscode folder in your sample project. To configure debug configuration, 2 files are required launch.json and tasks.json inside .vscode folder.

C++

VSCode can create and auto-configure these files if we try to debug for the first time. To do that, open C++ file in VSCode and either hit F5 or go to Debug -> Start Debugging and select C++ (GDB/LLDB) then select g++.exe build and debug active file.

This should create 2 files launch.json and tasks.json in .vscode folder which should look like below (update the MinGW64 path if not correct)

Notice that I’ve added one more optional configuration g++ build & run active file in launch.json and g++ build & run in tasks.json file for purpose of also Running C/C++ code without debugging. Now you may choose which configuration to pick when you start debugging. You may remove the configuration whichever you won’t need.

launch.json

tasks.json

tasks.json

externalConsole in launch.json can be set to true to see code output in cmd instead.

Restart VSCode to take effects of newly added compiler paths.

Open any C/C++ file, set some breakpoints (or not), and hit the Big Green Play Button.

(Shortcut to debug: F5 )

Tip: To hide *.exe files in the side explorer of VSCode, open settings and paste the below config:

Dev C Debug Tutorial

Thanks for reading. Would love to hear your thoughts about it. Connect with me onTwitter andLinkedIn.