-3
player.h:155:43: error: expected ‘;’ at end of member declaration
   void setCastDescription(std::string desc) cast.description = desc; }

player.h:155:45: error: ‘cast’ does not name a type
   void setCastDescription(std::string desc) cast.description = desc; }

player.h: In member function ‘bool Player::getCastingState() const’:
player.h:148:39: error: ‘cast’ was not declared in this scope
  bool getCastingState() const {return cast.isCasting; };
                                       ^

player.h: In member function ‘virtual const string& Player::getCastingPassword() const’:
player.h:149:65: error: ‘cast’ was not declared in this scope
  virtual const std::string & getCastingPassword() const {return cast.password; };
                                                                 ^

player.h: In member function ‘PlayerCast Player::getCast()’:
player.h:150:31: error: ‘cast’ was not declared in this scope
  PlayerCast getCast() {return cast; }
                               ^

player.h: In member function ‘void Player::setCastPassword(std::string)’:
player.h:153:39: error: ‘cast’ was not declared in this scope
  void setCastPassword(std::string p) {cast.password = p; };
                                       ^

player.h: At global scope:
player.h:156:28: error: expected initializer before ‘&’ token
  virtual const std::string & getCastDescription() const return cast.description; }
                            ^

player.h:156:82: error: expected declaration before ‘}’ token
  virtual const std::string & getCastDescription() const return cast.description; }
                                                                                  ^

this is my code what im trying to compile.. it is very large so im only going to post the lines where i get the error...

bool getCastingState() const {return cast.isCasting; };
virtual const std::string & getCastingPassword() const {return cast.password; };
PlayerCast getCast() {return cast; }

void setCasting(bool c);
void setCastPassword(std::string p) {cast.password = p; };

void setCastDescription(std::string desc) cast.description = desc; }
virtual const std::string & getCastDescription() const return cast.description; }

i already did search everywhere to find something similar but i dont get anything since yesterday i'm trying to find out a solution, i hope someone here can help me

1 Answers1

2

You are missing opening brackets for the getter and setter of cast description:

void setCastDescription(std::string desc) cast.description = desc; }
                                          ^
virtual const std::string & getCastDescription() const return cast.description; }
                                                       ^
Max Vollmer
  • 8,102
  • 9
  • 27
  • 43
  • i dont know what u mean by missing getter and setter – Yancarlos Mendez Sep 01 '18 at 14:36
  • I didn't write "missing getter and setter". I wrote "missing opening brackets". If you don't see what's wrong here, even with the `^` marking where the brackets are missing, you need to stop coding *"large code"* as you said yourself, and learn the basics, like [what are functions](https://www.tutorialspoint.com/cplusplus/cpp_functions.htm) and [what are curly brackets for](https://www.learncpp.com/cpp-tutorial/41-blocks-compound-statements/). – Max Vollmer Sep 01 '18 at 14:48
  • you right maybe i should stop coding, thank you for your answer... have a good day – Yancarlos Mendez Sep 01 '18 at 14:52
  • I am sorry if it came over like I want you to stop coding or learning to code. I am merely saying that you aren't doing yourself a favor if you start with *"large code"*. Start small. Learn the basics. Then, slowly, try out bigger projects. – Max Vollmer Sep 01 '18 at 15:07