SFML community forums

Help => Graphics => Topic started by: FrewCen on February 29, 2012, 08:42:32 am

Title: sf::Image and crazy sound
Post by: FrewCen 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:
(http://img714.imageshack.us/img714/3306/9de670a005ff41b3b8b396e.png)
Than, I'm getting this from visual studio:
(http://img717.imageshack.us/img717/233/6990449424c14212b39d6ce.png) (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]
Title: sf::Image and crazy sound
Post by: Laurent on February 29, 2012, 08:46:10 am
Make sure that you're not linking to release SFML libraries in debug mode.
Title: ...
Post by: FrewCen 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?)
Title: sf::Image and crazy sound
Post by: Laurent 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 ;)
Title: ..
Post by: FrewCen 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++...)