SFML community forums
Help => Graphics => Topic started 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:
#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:
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?
-
You forgot to define SFML_DYNAMIC (this is explained in the tutorial).
-
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?
-
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.