Dev-C++ Tutorial for CSC 161 Students (Maintained b

28 downloads 1029 Views 3MB Size Report
11/25/11. De -C++ T ia f CSC 161 S de. 1/7 . i e e - e a e.c /de c /# e 4. Dev-C++ Tutorial for CSC 161 Students (Maintained b. Michael Serrano).
11/25/11

De -C++ T

ia f

CSC 161 S de

Dev-C++ Tutorial for CSC 161 Students (Maintained b Michael Serrano)

Update (9/12/2006): I ' bee ie e i e i ce I' e da ed hi age; i fac , I i be ef , I' e da ed hi ia be c e i h he a e Ve i 5 Be a 9--a. .a. Ve i 4.9.9.2). Mike

ac e i

f i f a hie. I he h e ha i f De -C++ (a f hi i i g,

a

What is Dev-C++? De -C++, de e ed b B d hed S f a e, i a f fea ed g a hica IDE (I eg a ed De e e E i e ), hich i ab e c ea e Wi d c eba ed C/C++ ga i g he Mi GW c ie e . Mi GW (Mi i a i GNU* f Wi d ) e GCC ( he GNU g++ c ie c ec i ), hich i e e ia he a e c ie e ha i i C g i ( he i e i e g a f Wi d )a d e i f Li . The e a e, h e e , diffe e ce be ee C g i a d Mi GW; i Diffe e ce be ee C g i a d Mi GW f e i f ai .

Click pic re o enlarge.

*GNU i a ec i e ac on m fo "GNU' No Uni "; i i p ono nced "g h-NEW". The GNU P ojec a la nched in 1984 o de elop a f ee and comple e Uni -like ope a ing em.

Bloodshed!? I' be he fi a ha he a e B f B d hed e ai :

d hed

' gi e

a

a df

ie , b I hi

i ' be if he c ea

First I would lik e to sa that I am not a satanist, that I hate violence/war and that I don't lik e heav metal / hard-rock music. I am french, but I do k now the meaning of the "Bloodshed" word, and I use this name because I think it sounds well. If ou are offended b the name, I am ver sorr but it would be a big mess to change the name now. There's also a reason wh I k eep the Bloodshed name. I don't want people to think Bloodshed is a compan , because it isn't. I'm just doing this to help people. Here is a good remark on the Bloodshed name I received from JohnS: I assumed that this was a reference to the time and effort it requires of you to make these nice software programs, a la "Blood, Sweat and Tears". Peace and freedom, Colin Laplace

.

i

e e -e

a e.c

/de c

/# e 4

1/7

11/25/11

De -C++ T

ia f

CSC 161 S de

Ge ing De -C++ T

D -C++ ( '

B L

B

( ),

D -C++

Y

GPL) D -C++

D -C++

/

.

.

D -C++ -

CD

C:\D -C

,

.

U ing De -C++ T

.

A () D -C++

CSC161 / .

(. . /

/

( ),

). T

S ep 1: Config e De -C++. W G I

"Tools" "Settings" , information" "Yes":

C

. "Compiler Options". "L " ,

"Generate debugging

"OK".

S ep 2: C ea e a ne p ojec . A" " . G C H

"File" "Empt Project"

"New", "Project...". "C++ project" .Y

. , .

O D -C++ .

i

e e -e

a e.c

,

/de c

/# e 4

"OK". . 2/7

11/25/11

De -C++ T

Step 3: Create/add source file(s). Yo can add emp o ce file one of

ia f

CSC 161 S de

o a :

Go o he "File" men and elec "Ne Source File" (o j p e CTRL+N) OR Go o he "Project" men and elec "Ne File". No e ha De -C++ ill no a k fo a filename fo an ne o ce file n il o a emp o: 1. Compile 2. Sa e he p ojec 3. Sa e he o ce file 4. E i De -C++ Yo can add p e-e i ing o ce file one of

o a :

Go o he "Project" men and elec "Add to Project" OR Righ -click on he p ojec name in he lef -hand panel and elec "Add to Project". EXAMPLE: M l iple o ce file

I

hi e a e, e ha 3 fi e a e e i ed efe e ce "De e.h" ( hich e i e "De e.c e i e "Q e e.c ").

Step 4: Compile. Once o ha e en e ed all of o

c i e he g a ; The "d i e .c " fi e ") a d "De e.c " efe e ce "Q e e.h" ( hich

o ce code, o a e ead o compile.

Go o he "E ecute" men and elec "Compile" (o

j

pe

.

CTRL+F9)

I i likel ha o ill ge ome kind of compile o linke e o he fi ime o a p ojec . S n a e o ill be di pla ed in he "Compiler" ab a he bo om of he do ble-click on an e o o ake o o he place in he o ce code he e i occ ab ill fla h if he e a e an linke e o . Linke e o a e gene all he e l of allo ing one of he file o compile. Once o p ojec cce f ll compile , he "Compile Progress" dialog bo hi poin , o ma click "Close".

emp o compile a c een. Yo can ed. The "Linker" n a e o no

ill ha e a a

of "Done". A

Step 5: E ecute. .

i

e e -e

a e.c

/de c

/# e 4

3/7

11/25/11

De -C++ T

Yo can no

n o

ia f

CSC 161 S de

p og am.

Go o he "E ecute" men , choo e "Run". No e: o pa command-line pa ame e o o and pe in an pa ama e o i h o pa .

p og am, go o he "E ecute" men , choo e "Parameters"

Disappearing indo s If o e ec e o p og am ( i h o i ho pa ame e ), o ma no ice ome hing pec lia ; a con ole indo ill pop p, fla h ome e and di appea . The p oblem i ha , if di ec l e ec ed, con ole p og am indo clo e af e he p og am e i . Yo can ol e hi p oblem one of o a : Method 1 - Scaffolding: Add he follo ing code befo e an return a emen in main()o an e it()o abort() a emen (in an f nc ion): /* Scaffolding code fo e ing p po e */ cin.ignore(256, '\n'); cout ( ing eam )? In previous versions of Dev-C++, the included compiler did not implement sstream. Fortunatel , new versions of Dev-C++ do not have this problem. Upgrade to the latest version of Dev-C++.

Page cha ge l g: /12/2006: O e ha led page o be c

en

i h De -C++ 5 Be a 9 (4.9.9.2).

10/10/2001: Added eam info in FAQ. .

i

e e -e

a e.c

/de c

/# e 4

6/7

11/25/11

De -C++ T

4/16/2001: Fi ed e i

i bgi .h (c

3/23/2001: U da ed Wi BGI

i .h c

ia f

CSC 161 S de

fic ).

ced e .

3/21/2001: S a ed FAQ ec i

i h

i g a d BGI i f .

3/1 /2001: U da ed i gi f . 3/16/2001: Added i gi f .

Tha ' i f . Ia a De -C++ e e b a e i , fee f ee e ai e a Ha

ea (i fac , I eb a e @ i e e

e A - e

e' Xc de), b a e.c

if

ha e a

c di g!

Copyright 2006 Michael Serrano. La Modified 3:13 PM 9/12/2006

.

i

e e -e

a e.c

/de c

/# e 4

7/7