DevCppTutorialGraphics H
DevCppTutorialGraphics H
Update (9/12/2006):
I ' bee ie e i e i ce I' e da ed hi age; i fac , I ac f i f a hie. I he h e ha i a
i be ef , I' e da ed hi ia be c e i h he a e e i f De -C++ (a f hi i i g,
Ve i 5 Be a 9--a. .a. Ve i 4.9.9.2). Mike
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 e-
ba ed C/C++ ga i g he Mi GW c ie e . Click pic re o enlarge.
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 .
Bloodshed!?
I' be he fi a ha he a e B d hed ' gi e a a df ie , b I hi i ' be if he c ea
f B d hed e ai :
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.
Colin Laplace
Ge ing De -C++
T D -C++ ( GPL) CD
B ( ' ), D -C++ / .
L B D -C++ D -C++ .
Y D -C++ C:\D -C ,
- .
U ing De -C++
T .
A CSC161 (. . ( ),
() / / / ). T
D -C++ .
S ep 1: Config e De -C++.
W .
C "OK".
S ep 2: C ea e a ne p ojec .
A" "
.
Step 4: Compile.
Once o ha e en e ed all of o o ce code, o a e ead o compile.
Step 5: E ecute.
Yo can no n o p og am.
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):
Method 2 - Command-prompt:
Al e na i el , in ead of ing De -C++ o in oke o p og am, o can j open an MS-DOS P omp ,
go o he di ec o he e o p og am a compiled (i.e. he e o a ed he p ojec ) and en e he
p og am name (along i h an pa ame e ). The command-p omp indo ill no clo e hen he
p og am e mina e .
Step 6: Debug.
When hing a en' happening he a o planned, a o ce-le el deb gge can be a g ea ool in de e mining
ha eall i going on. De -C++' ba ic deb gge f nc ion a e con olled ia he "Debug" ab a he bo om of
he c een; mo e ad anced f nc ion a e a ailable in he "Debug" men .
I ha o do i h name pace . Yo need o add he follo ing line af e he incl de of o implemen a ion (.cpp)
file :
E ample:
#include <iostream>
#include <string>
in main()
{
string s;
s = "This is a test";
cout << s << endl;
system("PAUSE");
e n 0;
Go o he "Parameters" ab
In he "Linker" field, en e he follo ing e :
. i e e -e a e.c /de c /# e 4 5/7
11/25/11 De -C++ T ia f CSC 161 S de
-lbgi
-lgdi32
-lcomdlg32
-luuid
-loleaut32
-lole32
Click "OK".
Follow step 4, step 5 and step 6 of "Using Dev-C++".
Te code:
Just to make sure ou've got ever thing set up correctl , tr this test code in a new Dev-C++ WinBGIm project:
#include <graphics.h>
int main()
{
initwindow(400,300); //open a 400x300 graphics window
moveto(0,0);
lineto(50,50);
hile(!kbhit()); //wait for user to press a key
closegraph(); //close graphics window
return 0;
If ou've done ever thing correctl , ou should get a simple graphic that closes when the user presses a ke .
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 ia f CSC 161 S de
4/16/2001:
Fi ed e i i bgi .h (c i .h c fic ).
3/23/2001:
U da ed Wi BGI 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 ea (i fac , I e A e' Xc de), b if ha e a
e i , fee f ee e ai e a eb a e @ i e e - e a e.c
Ha c di g!