Tutorial Dev C++
Tutorial Dev C++
Getting Dev-C++
The author has released Dev-C++ as free software (under GPL).
Link to Bloodshed Dev-C++ for a list of Dev-C++ download sites.
You should let the installer put Dev-C++ in the default directory of C:\Dev-Cpp, as it will make it easier
to later install add-ons or upgrades.
Using Dev-C++
Step 1: Configure Dev-C++.
We need to modify one of the default settings to allow you to use the debugger with your programs.
Go to the "Tools" menu and select "Compiler Options".
In the "Settings" tab, click on "Linker" in the left panel, and change "Generate
debugging information" to "Yes":
Click "OK".
In this example, more than 3 files are required to compile the program; The "driver.cpp" file references "Deque.h"
(which requires "Deque.cpp") and "Deque.cpp" references "Queue.h" (which requires "Queue.cpp").
Step 4: Compile.
Once you have entered all of your source code, you are ready to compile.
Go to the "Execute" menu and select "Compile" (orxcx just press CTRL+F9).
It is likely that you will get some kind of compiler or linker error the first time you attempt to
compile a project. Syntax errors will be displayed in the "Compiler" tab at the bottom of the
screen. You can double-click on any error to take you to the place in the source code where it
occurred. The "Linker" tab will flash if there are any linker errors. Linker errors are generally
the result of syntax errors not allowing one of the files to compile.
Once your project successfully compiles, the "Compile Progress" dialog box will have a status of
"Done". At this point, you may click "Close".
Step 5: Execute.
You can now run your program.
Go to the "Execute" menu, choose "Run".
Note: to pass command-line parameters to your program, go to the "Execute" menu, choose
"Parameters" and type in any paramaters you wish to pass.
Disappearing windows
If you execute your program (with or without parameters), you may notice something peculiar; a console
window will pop up, flash some text and disappear. The problem is that, if directly executed, console
program windows close after the program exits. You can solve this problem as follows:
Add the following line at the beginning of your code:
#include <stdlib.h>
and the following line at the end of your source code, just before the closing } parenthesis:
system("PAUSE");
Step 6: Debug.
When things aren't happening the way you planned, a source-level debugger can be a great tool in
determining what really is going on. Dev-C++'s basic debugger functions are controlled via the
"Debug" tab at the bottom of the screen; more advanced functions are available in the "Debug"
menu.
Using the debugger:
The various features of the debugger are pretty obvious. Click the "Run to cursor" icon to run
your program and pause at the current source code cursor location; Click "Next Step" to step
through the code; Click "Add Watch" to monitor variables.
Setting breakpoints is as easy as clicking in the black space next to the line in the source code.
See the Dev-C++ help topic "Debugging Your Program" for more information.