Błędy przy kompilacji. ISO i inne.

0

Witam o tuż przy kompilacji programu wyskakuje mi mnóstwo błędów, nie umiem ich naprawić. :(

player.cpp|17|error: ISO C++ forbids declaration of 'moove' with no type [-fpermissive]|
player.cpp|17|error: prototype for 'int Player::moove(float, float)' does not match any in class 'Player'|
player.h|9|error: candidate is: void Player::moove(float, float)|
player.cpp|22|error: ISO C++ forbids declaration of 'setPosition' with no type [-fpermissive]|
player.cpp|22|error: prototype for 'int Player::setPosition(int, int)' does not match any in class 'Player'|
player.h|10|error: candidate is: void Player::setPosition(int, int)|
player.cpp|27|error: ISO C++ forbids declaration of 'setTexture' with no type [-fpermissive]|
player.cpp|27|error: prototype for 'int Player::setTexture(sf::Texture&)' does not match any in class 'Player'|
player.h|11|error: candidate is: void Player::setTexture(sf::Texture&)|
player.cpp|33|error: ISO C++ forbids declaration of 'draw' with no type [-fpermissive]|
player.cpp|33|error: prototype for 'int Player::draw(sf::RenderWindow&)' does not match any in class 'Player'|
player.h|12|error: candidate is: void Player::draw(sf::RenderWindow&)|

player.h

#include <SFML/Graphics.hpp>

class Player
{
public:
    Player();
    ~Player();

    void moove(float,float);
    void setPosition(int,int);
    void setTexture(sf::Texture &);
	void draw(sf::RenderWindow &);

	float x();
	float y();

private:
    int hp;
	int strength;
    float speed;

	sf::Texture *ptexture;
	sf::RectangleShape player;
};

player.cpp

#include "player.h"

Player::Player()
{
    hp = 100;
	strength = 5;
    speed = 250;

    ptexture = NULL;
}

Player::~Player()
{

}

Player::moove(float x, float y)
{
    player.move(x, y);
}

Player::setPosition(int x, int y)
{
    player.setPosition(x, y);
}

Player::setTexture(sf::Texture &t)
{
	ptexture = &t;
	player.setTexture(ptexture);
}

Player::draw(sf::RenderWindow &win)
{
    player(25,45);
    player.setOutlineColor(Color::Red);
    player.setOutlineThickness(1);
    win.draw(player);
}

float Player::x()
{
	return player.getPosition().x;
}

float Player::y()
{
	return player.getPosition().y;
}
1
void Player::moove(float x, float y)

Analogicznie z innymi funkcjami. Zresztą sam kompilator to zaproponował:

player.h|9|error: candidate is: void Player::moove(float, float)|
0

Niestety nie chodzi o to. Kolejne błędy przy kompialcji

player.cpp|17|error: ISO C++ forbids declaration of 'moove' with no type [-fpermissive]|
player.cpp|17|error: prototype for 'int Player::moove(float, float)' does not match any in class 'Player'|
player.h|9|error: candidate is: void Player::moove(float, float)|
player.cpp|22|error: ISO C++ forbids declaration of 'setPosition' with no type [-fpermissive]|
player.cpp|22|error: prototype for 'int Player::setPosition(int, int)' does not match any in class 'Player'|
player.h|10|error: candidate is: void Player::setPosition(int, int)|
player.cpp|27|error: ISO C++ forbids declaration of 'setTexture' with no type [-fpermissive]|
player.cpp|27|error: prototype for 'int Player::setTexture(sf::Texture&)' does not match any in class 'Player'|
player.h|11|error: candidate is: void Player::setTexture(sf::Texture&)|
player.cpp|33|error: ISO C++ forbids declaration of 'draw' with no type [-fpermissive]|
player.cpp|33|error: prototype for 'int Player::draw(sf::RenderWindow&)' does not match any in class 'Player'|
player.h|12|error: candidate is: void Player::draw(sf::RenderWindow&)|
1

Zapomniałeś o typie zwracanym przy definicjach funkcji. Powstawiaj tam w tym pliku .cpp odpowiednio te void-y, floaty i co tam jeszcze znajdziesz.

1 użytkowników online, w tym zalogowanych: 0, gości: 1