This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Hi can you please help me
- From: David Fang <fang at csl dot cornell dot edu>
- To: Maverick <duongthaiha at gmail dot com>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: Sat, 24 Feb 2007 14:23:54 -0500 (EST)
- Subject: Re: Hi can you please help me
> I am making a C++ program but i got some problem here.
> I have one header file and one source file Slover.hpp and Slover.cpp
>
> the content of the Slover.hpp is
>
> #ifndef SLOVER_HPP_
> #define SLOVER_HPP_
> #include <iostream>
> #include <cstdlib>
> #include <ctime>
> #include <math.h>
> #include <iomanip>
> #include <string>
> #include <vector>
>
> using namespace std;
>
> #include "Game.hpp"
>
> class Slover{
> private:
> typedef struct Guess {
> vector <char> guessPuzzle;
> int CorrectPosition;
> int CorrectColor;
> };
>
> vector <Guess> guesses;
> public:
> Slover();
> ~Slover();
> bool Guess (const Game* game, Guess &guessPuzzle);
>
>
> };
>
> and the Slover.cpp file is:
>
> using namespace std;
> #include "Slover.hpp"
>
> Slover(){
> }
// Did you mean: (You forgot the class name.)
Slover::Slover() { }
> ~Slover(){
> }
Slover::~Slover() { }
> bool Slover::Guess (const Game* game, Guess &guessPuzzle){
> //do something here
> return true;
>
> I got the error message:
> error: prototype for `bool Slover::Guess(const Game*, int&)' does not match
> any in class `Slover'
Again, you forgot the full class name before the constructor:
bool
Slover::Guess::Guess(...) {
}
> Can you please tell me what mistake that i have made there? And how can i
> fix this? I am quite new to C++ so please forgive if the question is not
> appropriate.
Fang