www.delorie.com/archives/browse.cgi | search |
From: | "Damian Yerrick" <web DOT poison AT pineight DOT 8m DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Strange behavior? |
Date: | Wed, 22 Sep 1999 20:51:06 -0500 |
Organization: | Rose-Hulman Institute of Technology |
Lines: | 79 |
Message-ID: | <7sc16m$t4q$1@solomon.cs.rose-hulman.edu> |
References: | <T3aG3.279$Mj5 DOT 391 AT nntpserver DOT swip DOT net> |
NNTP-Posting-Host: | yerricde.laptop.rose-hulman.edu |
X-Trace: | solomon.cs.rose-hulman.edu 938051606 29850 137.112.205.146 (23 Sep 1999 01:53:26 GMT) |
X-Complaints-To: | news AT cs DOT rose-hulman DOT edu |
NNTP-Posting-Date: | 23 Sep 1999 01:53:26 GMT |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.00.2314.1300 |
X-Mimeole: | Produced By Microsoft MimeOLE V5.00.2314.1300 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Gordon Bergström <gordon DOT bergstrom AT swipnet DOT se> wrote in message news:T3aG3.279$Mj5 DOT 391 AT nntpserver DOT swip DOT net... > Dear group. > > I'm having bigtime trouble with DJGPP. > > It tells me: > > game.cpp:5: semicolon missing after declaration of `class Player' From what I know of C++ (not much), that's your problem. Put a semicolon after the closing } of your class declaration. > player.cpp:3: semicolon missing after declaration of `Player' > player.cpp:4: extraneous `char' ignored > player.cpp:4: new declaration `class Player * Player::GetPlayerName() const' > player.h:11: ambiguates old declaration `char * Player::GetPlayerName() > const' A missing semicolon throws off the parser and compiler a great deal and causes them to spew more error messages. The first warning or generally usually points to the problem. > <----------CODE STARTS HERE------------> > <----Main prog----> > #include <iostream> > #include "player.h" > > main() > { > Player myPlayer; > cout << "Player:\t" << myPlayer.GetPlayerName() << endl; > cout << "Score:\t" << myPlayer.GetPlayerScore() << endl; > cout << "Position:\t" << myPlayer.GetPlayerPosition() << endl; > > return 0; > } > <-----------------> > #ifndef _Player_ > #define _Player_ > class Player > { > private: > char name[25]; > int score; > int position[4]; > > public: > char* GetPlayerName() const; > int GetPlayerScore() const; > int* GetPlayerPosition() const; > } > #endif > <------------> > #include "player.h" > > char* Player::GetPlayerName() const > { > return &namn; > } > > int Player::GetPlayerScore() const > { > return score; > } > > int* Player::GetPlayerPosition() const > { > return &position; > } > <--------------------CODE END----------------> -- Damian Yerrick http://pineight.webjump.com/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |