is Dev-C++ a good compiler?

Oct 14, 2008 at 3:12pm
I am using the free Bloodshed Dev-C++ compiler, version 4.9.9.2.

I want to know if any of yall have used it, and if it is a good compiler to use. I am asking because I am dont know a lot about programming.Most of the codes I have copyed and pasted, trying to compile, simply wont.

Here is the compile log when I try to compile snake:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
C:/Dev-Cpp/include/c++/3.4.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
D:\- C++\Untitled1.cpp:2:21: graphics.h: No such file or directory
D:\- C++\Untitled1.cpp:11: error: `main' must return `int'
D:\- C++\Untitled1.cpp: In function `int main(...)':
D:\- C++\Untitled1.cpp:12: error: `DETECT' undeclared (first use this function)

D:\- C++\Untitled1.cpp:12: error: (Each undeclared identifier is reported only once for each function it appears in.)
D:\- C++\Untitled1.cpp:13: error: `initgraph' undeclared (first use this function)

D:\- C++\Untitled1.cpp:44: error: `cleardevice' undeclared (first use this function)
D:\- C++\Untitled1.cpp:45: error: `setbkcolor' undeclared (first use this function)

D:\- C++\Untitled1.cpp:49: error: `rectangle' undeclared (first use this function)
D:\- C++\Untitled1.cpp:50: error: `outtextxy' undeclared (first use this function)
D:\- C++\Untitled1.cpp:51: error: `randomize' undeclared (first use this function)
D:\- C++\Untitled1.cpp:52: error: `random' undeclared (first use this function)
D:\- C++\Untitled1.cpp:72: error: `setcolor' undeclared (first use this function)

D:\- C++\Untitled1.cpp:92: error: `sound' undeclared (first use this function)

D:\- C++\Untitled1.cpp:102: error: `delay' undeclared (first use this function)
D:\- C++\Untitled1.cpp:102: error: `nosound' undeclared (first use this function)
D:\- C++\Untitled1.cpp:135: error: `getpixel' undeclared (first use this function)
D:\- C++\Untitled1.cpp:153: error: `settextstyle' undeclared (first use this function)

D:\- C++\Untitled1.cpp:156: error: `closegraph' undeclared (first use this function)

Execution terminated

Here is the source code,I found at planetsourcecode.com, for snake. Its been viewed 37055 times. I am guessing the problem is not in the code.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#include<iostream.h>
#include<graphics.h>
#include<iomanip.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
#include<stdio.h>
#include<time.h>

void main()
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "//bgi");


clock_t start,end,r;
  int x,y,i,x1,y1,j,l,m,temp,tail,col,scr,scr1,tempo;

char scrn[10];
// char key=0;
  temp=30;tail=3;
   scr1=0;
int a[300],b[300];
  i=y=x=0;


const char up='w';
const char dw='s';
const char ls='a';
const char rs='d';

cout<<"  RULES FOR THE GAME"<<endl;
cout<<"KEYS---"<<endl<<"  w- FORWARD"<<endl<<"  a- LEFT TURN"<<endl<<"  d- RIGHT TURN"<<endl<<"  s- DOWN"<<endl;
cout<<"  Q- QUIT"<<endl;
cout<<"  TURN CAPS LOCK OFF"<<endl;
cout<<"  EAT THE INSECTS N LIVE...U DIE IF U CROSS THE LIMIT / MOVE OVER UR SELF /"<<endl;
cout<<"  CROSS UR LEFTOVER SKIN."<<endl;
cout<<"  SHEADS SKIN AFTER REGULAR INTERVALS.."<<endl;
cout<<"  KEEP MOVING TO FIND FOOD ELSE U DIE"<<endl;
cout<<"	 POINTS ARE ADDED FOR EVERY INSECT YOU EAT,BUT EAT THE FIRST ONE BEFORE SECOND ONE COMES UP ELSE NO SCORE WILL BE ADDED UP"<<endl<<endl;
cout<<"  PRESS MOVE(a) KEY TO CONTINUE.....";
getch();

cleardevice();
setbkcolor(9);
for(j=0;j<=7;j++)
a[j]=b[j]=0;

rectangle(20,21,600,441);
outtextxy(20,5,"SCORE..");
randomize();
l=(random(520)+60);
if(l<=99)
{l=l/10;
l=l*10;}
else {l=l/10;
l=l*10;  }

m=(random(400)+40);
if(m<=99)
{m=m/10;
m=m*10; }
else {m=m/10;
m=m*10;  }
outtextxy(l,m,"*");

char key;
do

{

setcolor(15);
rectangle(20,21,600,440);
if(i==60||i==120||i==190||i==270)
{
l=(random(520)+50);
if(l<=99)
{l=l/10;
l=l*10;}
else {l=l/10;
  l=l*10;  }

m=(random(400)+30);
if(m<=99)
{m=m/10;
m=m*10; }
else {m=m/10;
  m=m*10;  }

setcolor(15);
outtextxy(l,m,"ì");
sound(3800);

 }

start=clock();
 key=getch();
   end=clock();
    r=end-start;
   if(r>=15)
    { outtextxy(100,100,"YOU ARE TOO SLOW...:-( ");
    delay(1000);nosound();break;}

if (i==300 )
{ i=0;}

{
 if(key==up)
 { y-=10;}
 if(key==dw)
 { y+=10;}
  if(key==ls)
 { x-=10;}
  if(key==rs)
 { x+=10;}
  }
  setcolor(10);
 a[i]= x1=210+x;
 b[i]= y1=210+y;
if(x1==l && y1==m)
 { scr1++;
 scr=10*scr1;
 sprintf(scrn,"%d",scr);
   nosound();
   setcolor(0);
outtextxy(70,5,"ÛÛ");
setcolor(15);
outtextxy(70,5,scrn);

  temp+=10;tail++; }

if(x1==20||x1==600||y1==20||y1==440)
{nosound();break;}

col=getpixel(x1,y1);
if(col>0)
  break;
  nosound();
  tempo=tail;

 if(i>=(299-tempo))
{ setcolor(4);
 tempo--  ;
}
 outtextxy(x1,y1,"X");
  setcolor(0);
  outtextxy(a[i-tail],b[i-tail],"X" );
i++;


} while (key !='q');

settextstyle(2,0,26);
outtextxy(210,210,"OUT");
 getch();
closegraph();

}


Can yall help me find out what exactly the problem is. Thank you.
Oct 14, 2008 at 3:55pm
Your code doesn't work because you are missing graphics.h.
An other problem is that that source code is calling standard headers in an old style.
Oct 14, 2008 at 4:02pm
"... an old style." ?

What does that mean? Are there different standards? How do I fix it?

Where can I get the graphics.h? Is there some place I can go and dl all the standard headers? I have alreaded googled several key word groups with no results. Im not even sure what to search for.

Thank you bazzy, for your help.
Oct 14, 2008 at 4:19pm
Old style:
1
2
#include<iostream.h>
#include<iomanip.h> 

new style:
1
2
3
#include<iostream>
#include<iomanip>
using namespace std;

(These headers are the only two in your code that need to be canged)


What I found is:
graphics.h http://www.koders.com/cpp/fid34D3E473F5E0CD0C1B6D41F6872F5BA400722F35.aspx?s=graphics.h
this header is calling unistd.h http://linux.die.net/include/unistd.h
that calls features.h http://linux.die.net/include/features.h
... Many of them ... look for all you need at http://linux.die.net/include
Last edited on Oct 14, 2008 at 4:35pm
Oct 15, 2008 at 12:54am
Thanks again Bazzy, you have been a huge help to me.

Still I would like yo know if Dev-C++ v4.9.9.2 a good compiler to use. From what I have seen on google, it looks to be good. But I dont have the exp to know any better.

Are there better compilers out there?
Oct 15, 2008 at 1:53am
code::blocks is awesome!
http://www.codeblocks.org/
Oct 18, 2008 at 5:05pm
Dev is good for a beginner.
Also, try to avoid <graphics.h>. It is an old Borland resource, and Windows (and often compiler) specific.
I haven't used Code::Blocks, so I don't know how good it is.
Oct 20, 2008 at 7:12pm
Errr christ, I feel like I type this 100x a week.

Dev-C++ is NOT a compiler. It's an IDE. The Compiler it comes with by default is MingW (a windows port of GCC). Code::Blocks by default uses the same bloody compiler.

Most C++ developers who need to write platform independent code will use MingW on Windows and GCC on Linux because they are pretty much identical.

That code you've downloaded looks like a terrible mis-match of C and C++ that seems to be quite Borland Compiler specific. Just because alot of people have viewed it doesn't mean it's any good *cough*Paris Hilton Video*cough*
Oct 20, 2008 at 10:50pm
Zaita, I never did understand that video. Her boyfriend was such a Dou**e. How did he end up with a great* girl like Paris. Sure, the video sucked, but that BJ was second to none, that lucking SOB.

* Great in the sence that she:
is rich
is very rich
can get you into anywhere, anytime with any one
umm, well she... AH... she like to play vaccuum, and she is good at it.
OH did I mention she is very very very rich!

Last edited on Oct 20, 2008 at 10:51pm
Topic archived. No new replies allowed.