SFML community forums

Help => Graphics => Topic started by: programmer47 on August 29, 2010, 07:05:35 pm

Title: sf::Sprite error
Post by: programmer47 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]
Title: sf::Sprite error
Post by: Laurent on August 29, 2010, 07:09:58 pm
You forgot to define SFML_DYNAMIC (this is explained in the tutorial).
Title: sf::Sprite error
Post by: programmer47 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?
Title: sf::Sprite error
Post by: Laurent 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.