Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: HELP!! Function prototype doesnt match any in class  (Read 2054 times)

0 Members and 1 Guest are viewing this topic.

supdawg

  • Newbie
  • *
  • Posts: 33
    • View Profile
HELP!! Function prototype doesnt match any in class
« 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()

supdawg

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: HELP!! Function prototype doesnt match any in class
« Reply #1 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

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10821
    • View Profile
    • development blog
    • Email
Re: HELP!! Function prototype doesnt match any in class
« Reply #2 on: November 11, 2012, 01:06:50 am »
Read this 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... -.-
« Last Edit: November 11, 2012, 01:09:07 am by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

supdawg

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: HELP!! Function prototype doesnt match any in class
« Reply #3 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. :(

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10821
    • View Profile
    • development blog
    • Email
AW: HELP!! Function prototype doesnt match any in class
« Reply #4 on: November 11, 2012, 01:29:15 am »
Please follow the rules linked above!

Are you sure you're not compiling an old file?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

supdawg

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: HELP!! Function prototype doesnt match any in class
« Reply #5 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.

 

anything