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

Author Topic: sf::Sprite error  (Read 2591 times)

0 Members and 2 Guests are viewing this topic.

programmer47

  • Newbie
  • *
  • Posts: 12
    • View Profile
sf::Sprite error
« on: August 29, 2010, 07:05:35 pm »
programmer47 (12)     Aug 29, 2010 at 4:35pm
Hi all,

I'm trying to display an image on the screen with SFML (using Dev-C++). An error occurs when I try to declare a sprite with sf::Sprite. This is my code:
Code: [Select]

#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
    sf::Image image;
    if (!image.LoadFromFile("image.tga"))
    {
       std::cout << "Error loading image!" << std::endl;
    }
    sf::Sprite sprite;
    sprite.SetImage(image);
    return 0;
}

This is the error:
Code: [Select]

variable 'vtable for sf::Sprite' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.

 


I have followed the tutorials on SFML-Dev.org, can anyone help prevent this error?
Code: [Select]

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::Sprite error
« Reply #1 on: August 29, 2010, 07:09:58 pm »
You forgot to define SFML_DYNAMIC (this is explained in the tutorial).
Laurent Gomila - SFML developer

programmer47

  • Newbie
  • *
  • Posts: 12
    • View Profile
sf::Sprite error
« Reply #2 on: August 29, 2010, 07:12:05 pm »
I saw that but I don't have Code::Blocks and I couldn't find an option for it in Dev-C++, could you tell me where it is?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::Sprite error
« Reply #3 on: August 29, 2010, 07:17:43 pm »
I don't know, I searched a little and found this:
Project -> Project Options -> Parameters -> C++ compiler -> add -DSFML_DYNAMIC

But you should stop using Dev-C++, it's a dead project.
Laurent Gomila - SFML developer

 

anything