I'm having a bit of trouble with sfml and the error that is the title is currently being thrown at me.
This is the class I have created
#include <SFML/Graphics.hpp>
#ifndef SNAKEHEAD_H
#define SNAKEHEAD_H
class SnakeHead
{
private:
int iPosX;
int iPosY;
public:
sf::RectangleShape snakeHead;
SnakeHead();
SnakeHead(int iX, int iY);
bool wallCheck();
bool collideCheck(int iX, int iY);
void move(char cMovement);
sf::RectangleShape createSquare();
};
#endif
This is the important parts of the main code
SnakeHead player1();
SnakeHead* player2 = player1;
On a side note, I only tried to do this to fix a different issue. The other error I got was: "expression must have a class type"
Here is the important part of the class functions
sf::RectangleShape SnakeHead::createSquare()
{
snakeHead.setSize(sf::Vector2f(20.f, 20.f));
snakeHead.setOrigin(0.f, 0.f);
snakeHead.setPosition(iPosX, iPosY);
snakeHead.setFillColor(sf::Color::Red);
return snakeHead;
}
Here is the important part of the main code
window.draw(player1.createSquare());