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

Author Topic: sf::Image and crazy sound  (Read 2884 times)

0 Members and 1 Guest are viewing this topic.

FrewCen

  • Newbie
  • *
  • Posts: 8
    • View Profile
sf::Image and crazy sound
« on: February 29, 2012, 08:42:32 am »
Hi.

I have successfuly compiled SFML for VC2010 and window is running.
Unfortunately , I have new problem.
Code: [Select]
#include <SFML\System.hpp>
#include <SFML\Graphics.hpp>
#include <SFML\Window.hpp>
#include <iostream>

int main(int argc, char **argv[])
{
sf::RenderWindow WND(sf::VideoMode(800, 600, 32), "LOLOLOLOLOLOLOL");
sf::Image img;
img.LoadFromFile("test.jpg");
sf::Sprite sprite;
sprite.SetImage(img);
sprite.SetPosition(20.0f, 20.0f);
while(WND.IsOpened())
{
sf::Event Event;
while(WND.GetEvent(Event))
{
switch(Event.Type)
{
case sf::Event::Closed:
WND.Close();
break;
case sf::Event::MouseLeft:
WND.Close();
break;
default:
break;
}
}

WND.Clear();
WND.Draw(sprite);
WND.Display();
}
return 0;
}

This is my code. My error is not writeable. When the program arrive on the code
Code: [Select]
sf::Image img;
img.LoadFromFile("test.jpg");

, it starts to beep... BEEP BEEP BEEP. And in console I have this output:

Than, I'm getting this from visual studio:
(On starting is: Failed to load image nad some characters)
So whats should I do? Please help.

P.S.: I've tried to place text "Crazy beeping sfml" to google and it not helped.[/quote]

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::Image and crazy sound
« Reply #1 on: February 29, 2012, 08:46:10 am »
Make sure that you're not linking to release SFML libraries in debug mode.
Laurent Gomila - SFML developer

FrewCen

  • Newbie
  • *
  • Posts: 8
    • View Profile
...
« Reply #2 on: February 29, 2012, 08:59:19 am »
Do you mean: /MTd and /MDd or ?
If you mean releases and versions, I have 1.6 (which was compiled by me).
(and if you mean the build functions in visual studio where are: debug, debug dll, debug static, release, release dll, release static...... do you?)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::Image and crazy sound
« Reply #3 on: February 29, 2012, 09:14:07 am »
There are two variants of the SFML libraries: debug and release.
There are two variants of your program: debug and release.
I mean: don't mix them ;)
Laurent Gomila - SFML developer

FrewCen

  • Newbie
  • *
  • Posts: 8
    • View Profile
..
« Reply #4 on: February 29, 2012, 09:58:59 am »
Thanks, works!!!
(Sorry for idiot questions, but before I started c++ i worked in C#... since than everything changes and now I have little problem to use c++...)