SFML community forums

Help => General => Topic started by: supdawg on November 11, 2012, 12:58:04 am

Title: HELP!! Function prototype doesnt match any in class
Post by: supdawg on November 11, 2012, 12:58:04 am
ive been stuck for 2 days and i cant figure it out

  ~                                                                                                  
 NORMAL  GameScreen.cpp                                          unix │ utf-8 │ cpp   70%  LN  19:20
"GameScreen.cpp" 27L, 408C written
    1 #include "GameScreen.h"
    2
    3   GameScreen::GameScreen(){
    4     //ctor
    5   }
    6
    7   GameScreen::~GameScreen(){
    8     //dtor
    9   }
   10
   11   void GameScreen::loadContent(){
   12
   13   }//end of loadContent()
   14
   15   void GameScreen::unloadContent(){
   16
   17   }//end of unloadContent()
   18 ..
>> 19   void GameScreen::update(sf::Event event){
   20
   21   }//end of update()
   22
   23   void GameScreen::draw(sf::RenderWindow &window){
   24
   25   }//end of draw(sf::RenderWindow &window)

  ~                                                                                                  
 NORMAL  GameScreen.cpp                                          unix │ utf-8 │ cpp   70%  LN  19:20
"GameScreen.cpp" 27L, 408C written
    1 #include "GameScreen.h"
    2
    3   GameScreen::GameScreen(){
    4     //ctor
    5   }
    6
    7   GameScreen::~GameScreen(){
    8     //dtor
    9   }
   10
   11   void GameScreen::loadContent(){
   12
   13   }//end of loadContent()
   14
   15   void GameScreen::unloadContent(){
   16
   17   }//end of unloadContent()
   18 ..
>> 19   void GameScreen::update(sf::Event event){
   20
   21   }//end of update()
   22
   23   void GameScreen::draw(sf::RenderWindow &window){
   24
   25   }//end of draw(sf::RenderWindow &window)

error prototype for void GameScreen::update(sf::Event) doesnt match any in class GameScreen. candidate is virtual void update()
Title: Re: HELP!! Function prototype doesnt match any in class
Post by: supdawg on November 11, 2012, 01:05:12 am
SORRY i  forgot to put header code

  1 #ifndef GAMESCREEN_H
  2 #define GAMESCREEN_H
  3 #include <SFML/Graphics.hpp>
  4 #include <SFML/Window.hpp>
  5 #include "InputManager.h"
  6
  7 class GameScreen{
  8   public:
  9     GameScreen();
 10     virtual ~GameScreen();
 11
 12     virtual void loadContent();
 13     virtual void unloadContent();
 14     virtual void update(sf::Event event);
 15     virtual void draw(sf::RenderWindow &window);
 16
 17   protected:
 18     InputManager input;
 19     std::vector<sf::Keyboard::Key> keys;
 20 };
 21
 22 #endif
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
 NORMAL  GameScreen.h                                            unix &#9474; utf-8 &#9474; cpp   27%  LN   6:1  
E488: Trailing characters
Title: Re: HELP!! Function prototype doesnt match any in class
Post by: eXpl0it3r on November 11, 2012, 01:06:50 am
Read this (http://en.sfml-dev.org/forums/index.php?topic=5559.0) first...

Also the answer has already been given by the compiler:
error prototype for void GameScreen::update(sf::Event) doesnt match any in class GameScreen. candidate is virtual void update()
Which means that you maybe haven't save the GameScreen.h or similar.

And please fix your code formatting!!
Don't just c&p from your terminal running vim... -.-
Title: Re: HELP!! Function prototype doesnt match any in class
Post by: supdawg on November 11, 2012, 01:21:41 am
the error goes away if i take away the parameters for
 
void GameScreen::update(sf::Event)
but as soon as i add the parameter sf::Event the error comes back. And why would the candidate be:
void GameScreen::update()

i just dont get it. i saved everything and the function prototype looks the same as the function definition. :(
Title: AW: HELP!! Function prototype doesnt match any in class
Post by: eXpl0it3r on November 11, 2012, 01:29:15 am
Please follow the rules linked above!

Are you sure you're not compiling an old file?
Title: Re: HELP!! Function prototype doesnt match any in class
Post by: supdawg on November 11, 2012, 01:38:42 am
sorry about not following the forum rules.

and what exactly do u mean by compiling an "old file"?

im on Mac OSX Mountain Lion using iterm2 with vim.
compiler is g++

my GameScreen class is a base class for other classes. and yea i dont know whats going on. i doubt im compiling another file or an old file because GameScreen.h and GameScreen.cpp are the only files with those names in my directory.