Dev-C++ is a free integrated development environment for creating C and C++ programs on Windows. It uses the MinGW compiler system which is similar to what is used in Cygwin. The tutorial walks through setting up Dev-C++, creating a new project, adding source code files, compiling, running, and debugging a program. Key steps include configuring compiler options, creating and building a project, running the program, and using the debugger to step through code and monitor variables.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
140 views
DevCpp Tutorial
Dev-C++ is a free integrated development environment for creating C and C++ programs on Windows. It uses the MinGW compiler system which is similar to what is used in Cygwin. The tutorial walks through setting up Dev-C++, creating a new project, adding source code files, compiling, running, and debugging a program. Key steps include configuring compiler options, creating and building a project, running the program, and using the debugger to step through code and monitor variables.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4
Dev-C++ Tutorial for
Windows (by Mike Serrano)
What is Dev-C++? Dev-C++, developed by Bloodshed Software, is a fully featured graphical IDE (Integrated Developent Environent!, which is able to create "indows or console-based C#C++ progras using the $in%" copiler syste& $in%" ($inialist %'() for "indows! uses %CC (the %'( g++ copiler collection!, which is essentially the sae copiler syste that is in Cygwin (the uni* environent progra for "indows! and ost versions of +inu*& ,here are, however, differences between Cygwin and $in%"- lin. to Differences between Cygwin and $in%" for ore inforation& Gettin Dev-C++ ,he author has released Dev-C++ as free software (under %/+!& +in. to Bloodshed Dev-C++ for a list of Dev-C++ download sites& 0ou should let the installer put Dev-C++ in the default directory of C12Dev-Cpp, as it will a.e it easier to later install add-ons or upgrades& !sin Dev-C++ Ste" #$ Confiure Dev-C++% "e need to odify one of the default settings to allow you to use the debugger with your progras& %o to the 3Tools3 enu and select 3Compiler Options3& In the 3Settings3 tab, clic. on 3+in.er3 in the left panel, and change 3Generate debugging information3 to 3Yes31 Clic. 3OK3& Ste" #b (&'() for those who use Windows *+ST,)% 4gain, go to the 3Tools3 enu and select 3Compiler Options3& In the 3Programs3 tab, change 3gcc.exe3 to 3g++.exe3& Ste" -$ Create a new "ro.e/t% 4 3pro5ect3 can be considered as a container that is used to store all the eleents that are re6uired to copile a progra& %o to the 3File3 enu and select 3Ne3, 3Pro!ect...3& Choose 3"mpt# Pro!ect3 and a.e sure 3C pro!ect3 is selected& 7ere you will also give your pro5ect a nae& 0ou can give your pro5ect any valid filenae, but .eep in ind that the nae of your pro5ect will also be the nae of your final e*ecutable& 8nce you have entered a nae for your pro5ect, clic. 3OK3& Dev-C++ will now as. you where to save your pro5ect& Ste" 0$ Create1add sour/e file(s)% 0ou can add epty source files one of two ways1 %o to the 3File3 enu and select 3Ne Source File3 (or 5ust press C,9++'! 89 %o to the 3Pro!ect3 enu and select 3Ne File3& 'ote that Dev-C++ will not as. for a filenae for any new source file until you attept to1 :& Copile ;& Save the pro5ect <& Save the source file =& E*it Dev-C++ 0ou can add pre-e*isting source files one of two ways1 %o to the 3Pro!ect3 enu and select 3$dd to Pro!ect3 89 9ight-clic. on the pro5ect nae in the left-hand panel and select 3$dd to Pro!ect3& EXAMPLE: Multiple source files In this example, more than 3 files are required to compile the program; he !dri"er#cpp! file references !$eque#h! %&hich requires !$eque#cpp!' and !$eque#cpp! references !(ueue#h! %&hich requires !(ueue#cpp!'# Ste" 2$ Co3"ile% 8nce you have entered all of your source code, you are ready to copile& %o to the 3"xecute3 enu and select 3Compile3 (or*c* 5ust press C,9++>?!& It is li.ely that you will get soe .ind of copiler or lin.er error the first tie you attept to copile a pro5ect& Synta* errors will be displayed in the 3Compiler3 tab at the botto of the screen& 0ou can double-clic. on any error to ta.e you to the place in the source code where it occurred& ,he 3%in&er3 tab will flash if there are any lin.er errors& +in.er errors are generally the result of synta* errors not allowing one of the files to copile& 8nce your pro5ect successfully copiles, the 3Compile Progress3 dialog bo* will have a status of 3'one3& 4t this point, you ay clic. 3Close3& Ste" 4$ 56e/ute% 0ou can now run your progra& %o to the 3"xecute3 enu, choose 3(un3& 'ote1 to pass coand-line paraeters to your progra, go to the 3"xecute3 enu, choose 3Parameters3 and type in any paraaters you wish to pass& Disappearing windows If you e*ecute your progra (with or without paraeters!, you ay notice soething peculiar- a console window will pop up, flash soe te*t and disappear& ,he proble is that, if directly e*ecuted, console progra windows close after the progra e*its& 0ou can solve this proble as follows1 4dd the following line at the beginning of your code1 #include <stdlib.h> and the following line at the end of your source code, 5ust before the closing @AB parenthesis1 system("PAUSE"); Ste" 7$ Debu% "hen things arenCt happening the way you planned, a source-level debugger can be a great tool in deterining what really is going on& Dev-C++Cs basic debugger functions are controlled via the 3'ebug3 tab at the botto of the screen- ore advanced functions are available in the 3'ebug3 enu& Using the debugger: ,he various features of the debugger are pretty obvious& Clic. the 3(un to cursor3 icon to run your progra and pause at the current source code cursor location- Clic. 3Next Step3 to step through the code- Clic. 3$dd )atc*3 to onitor variables& Setting brea.points is as easy as clic.ing in the blac. space ne*t to the line in the source code& See the Dev-C++ help topic 3Debugging 0our /rogra3 for ore inforation&
Python Programming Reference Guide: A Comprehensive Guide for Beginners to Master the Basics of Python Programming Language with Practical Coding & Learning Tips