#### Archived

This topic is now archived and is closed to further replies.

# What's wtih DevC++ compiler?

This topic is 5803 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

After repeated failure with getting things to work on BCC55, I''ve tried switching over to DevC++, but my problems refuse to relent. I made a little test program consisting of a simple "Person" class. It has private fields for name, age, and gender, 3 constructors (default, one asking for their name, age, and gender, and a copy), and then three accessor fields (one for each private field). Then I have the test program to impliment it. It requests the user''s name/age/gender. Then prints out their age. Trivial, but again, just a test. I kept everything in the same *.cpp file, added it to a DevC++ project and tried to compile it, but I got a slew of crazy errors, including, but not limited to: syntax error before '';'' parse error before ''n'' syntax error before''('' ''name'' undeclared (first use this function) (Each undeclared identifier is reported only once for each function it appears in.) ANSI C++ forbids declaration ''age'' with no type. ''g'' was not declared in this scope. .... .... It''s as if it doesn''t know what a class is =-( Earlier I was having more problems trying to get some Dx tutorial code to work, but I get more and more errors each time I compile (that''s how it feels anyway). How can I begin to learn more complicated things if I can''t get the begining tutorial code to run??? Problems like this don''t instill confidence in the workability of C++ compilers, I doubt I would ever spend a lot of money on a professional one if I''m just going to end up with more errors. I just don''t see how so many people are having fun with things like Direct X and game programming when I can''t get pre-made ready-to-work code examples to work. It''s really aggrivating and I''ve been trying to figure it out for about a week. I don''t want to invest money in a book on it, either, because I''m sure I''ll get it in the mail and find out I can''t get it to run. Can anyone help me out here? "I''''m not evil... I just use the power of good in evil ways."

##### Share on other sites
First off, the errors are not in the compilier, you are causing them. Secondly, if you post your code, I''d be glad to help you out, I just can''t say much without seeing some code. And finally thirdly, DX is very hard to set up in DevC++, I''m not saying it can''t be done, but it is hard, it took me almost a month before I figured it out, and by then I just caved and bought VC++. So post your code and I''ll see if I can help or not.

##### Share on other sites
Post your code, maybe we can spot the mistake. Often the silly little things are the hardest to notice.

##### Share on other sites
quote:
Original post by Tac-Tics
After repeated failure with getting things to work on BCC55, I''ve tried switching over to DevC++, but my problems refuse to relent.

I made a little test program consisting of a simple "Person" class. It has private fields for name, age, and gender, 3 constructors (default, one asking for their name, age, and gender, and a copy), and then three accessor fields (one for each private field).

Then I have the test program to impliment it. It requests the user''s name/age/gender. Then prints out their age. Trivial, but again, just a test.

I kept everything in the same *.cpp file, added it to a DevC++ project and tried to compile it, but I got a slew of crazy errors, including, but not limited to:
syntax error before '';''
parse error before ''n''
syntax error before''(''
''name'' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
ANSI C++ forbids declaration ''age'' with no type.
''g'' was not declared in this scope.
....
....

It''s as if it doesn''t know what a class is =-(

Earlier I was having more problems trying to get some Dx tutorial code to work, but I get more and more errors each time I compile (that''s how it feels anyway). How can I begin to learn more complicated things if I can''t get the begining tutorial code to run???

Problems like this don''t instill confidence in the workability of C++ compilers, I doubt I would ever spend a lot of money on a professional one if I''m just going to end up with more errors. I just don''t see how so many people are having fun with things like Direct X and game programming when I can''t get pre-made ready-to-work code examples to work. It''s really aggrivating and I''ve been trying to figure it out for about a week. I don''t want to invest money in a book on it, either, because I''m sure I''ll get it in the mail and find out I can''t get it to run. Can anyone help me out here?

"I''m not evil... I just use the power of good in evil ways."

The first thing most people here will want is for you to post a snippet of code so we can try to figure out where the problem might be comming from. Now, as for your confidence in C++ compilers, once we you get the hang of C++''s objects, I''m sure it will change.

"And that''s the bottom line cause I said so!"

Cyberdrek

Resist Windows XP''s Invasive Production Activation Technology!

"gitty up" -- Kramer
/(bb|[^b]{2})/ that is the Question -- ThinkGeek.com
Hash Bang Slash bin Slash Bash -- #!/bin/bash

##### Share on other sites
OK, but first, how do I make those little code boxes for the forum? I''ve seen other people using them, but I don''t know how to do it myself.

"I''''m not evil... I just use the power of good in evil ways."

##### Share on other sites
http://www.gamedev.net/community/forums/faq.asp

Edited by - lessbread on February 25, 2002 8:49:03 AM

##### Share on other sites
Thnx for the link to the FAQ. Only now does the big question mark link stand out for me to find =-)

  #include class Person{private: string name; int age; bool gender; // 1 = male 0 = femalepublic: Person (); Person (string n, int a, bool g); Person (Person& p); string getName (); int getAge (); bool getGender ();};Person::Person (){ name = "John"; age = 16; gender = true;}Person::Person (string n, int a, bool g){ name = n; age = a; gender = g;}Person::Person (Person& p){ name = p.getName(); age = p.getAge(); gender = p.getGender();}string Person::getName (){ return (name);}int Person::getAge (){ return (age);}bool Person::getGender (){ return (gender);}int main (){ string n; cout << "Enter name: "; cin >> n; cout << endl; int a; cout << "Enter age: "; cin >> a; cout << endl; bool g; cout << "Enter gender: "; cin >> g; cout << endl; Person you(n, a, g); cout << "Your age is " << you.getAge(); return (0);}

Well there it is. I hope I''m not missing something obvious =-/

"I''''m not evil... I just use the power of good in evil ways."

##### Share on other sites
A couple things I noticed immediately: You''re not including string. The string class is in the std namespace. I''ll try compiling it when I get the chance, and then I''ll find all of the problems (if no one else does that before me).

##### Share on other sites
Simple error

replace the #include
with

#include <iostream>
#include <string>

-you cant use string if you don''t define it

Now if only you could cut and paste code sections without it becoming one big line...

##### Share on other sites
N&V - that was the only error