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

Author Topic: Image.LoadFromFile() and general image creation failure  (Read 2693 times)

0 Members and 1 Guest are viewing this topic.

Jeff8500

  • Newbie
  • *
  • Posts: 6
    • View Profile
Image.LoadFromFile() and general image creation failure
« on: June 27, 2009, 01:44:09 am »
I recently found SFML and have been going through the tutorials. However, while playing with the graphics package, my programs began beeping mysteriously, etc.. Here is the snippet that causes the crash (I commented other segments, such as event handling, out):

Code: [Select]

#include <SFML/Graphics.hpp>

int main()
{
sf::RenderWindow App(sf::VideoMode(800,600,32), "Test");
App.SetFramerateLimit(30);

sf::Image Image;
if(!Image.LoadFromFile("player.png")) //this line causes strange beeping issues
{
Image.Create(20,40,sf::Color(150,250,255,255));
}
   return EXIT_SUCCESS;
}



As the comment states, trying to load an image from a file causes a strange beeping that always comes out through my speakers, regardless of whether I muted them or whether I have my headphones in the computer; it's a nuisance that I cannot seem to avoid. Also, when I remove trying to load an image, and just create one myself, VC++'s debug states that the stack around the RenderWindow is corrupt; trying to ignore that error causes the program to stop working. Does anyone know how to resolve these issues? Thanks in advance.

Mr. X

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Image.LoadFromFile() and general image creation failure
« Reply #1 on: June 27, 2009, 08:13:06 am »
Maybe you've linked the wrong library. You have to link the debug ("-d") librarys in debug configuration and the others in release.

Jeff8500

  • Newbie
  • *
  • Posts: 6
    • View Profile
Image.LoadFromFile() and general image creation failure
« Reply #2 on: June 28, 2009, 07:21:11 pm »
I did link to the wrong libraries, thanks!

 

anything