1
Graphics / Texture.loadFromFile("") error
« on: March 07, 2018, 11:44:27 am »
Hi there, i cant make a sprite sheet appear on my game screen. I am using codeblocks as my IDE and the way I am trying to achieve it is by doing this:
Any help is appreciated
int main()
{
gameWindow.create(sf::VideoMode(1000,800),"My Game",sf::Style::Titlebar | sf::Style::Close);
sf::Texture pTexture;
sf::Sprite playerImage;
pTexture.loadFromFile("Player.png");//this is where i am getting the error
playerImage.setTexture(pTexture);
while(gameWindow.isOpen())
{
while(gameWindow.pollEvent(event))
{
if(event.type==sf::Event::Closed)gameWindow.close();
}
gameWindow.draw(playerImage);
gameWindow.display();
}
}
the error in the logs is this : "undefined reference to `_imp___ZN2sf7Texture12loadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_4RectIiEE'"{
gameWindow.create(sf::VideoMode(1000,800),"My Game",sf::Style::Titlebar | sf::Style::Close);
sf::Texture pTexture;
sf::Sprite playerImage;
pTexture.loadFromFile("Player.png");//this is where i am getting the error
playerImage.setTexture(pTexture);
while(gameWindow.isOpen())
{
while(gameWindow.pollEvent(event))
{
if(event.type==sf::Event::Closed)gameWindow.close();
}
gameWindow.draw(playerImage);
gameWindow.display();
}
}
Any help is appreciated