SFML community forums
Help => General => Topic started by: Glue on January 25, 2011, 03:48:34 pm
-
Hello, once again i get problems, but this time there isn't any errors. The LoadFromFile() function simply fails to do what it's supposed to do.
if(!this->Image.LoadFromFile("back.jpg"))
{
MessageBox(ghWnd,L"Doesnt Work",L"Cant Load",MB_OK);
}
Yes, back.jpg is in the same directory as the exe compiled. I have tried to run it from there too, same thing.
Suggestions?
Release Static
SFML 2
Windows 7
MSVC++ Express 2010
-
What message do you get in the standard output?
-
Uhm, How do you mean standard output? :roll:
-
Normal output like std::cout.
Anyway, having it in the same folder as the exe-file won't work. You have to place it in the working directory(I.E: Where you call the exe-file from) and from a IDE this is most often the project folder. You can set manually in the project settings/properties where the working directory should be.
-
If you don't have a console, either change your project settings to make it appear, or redirect std::cerr to a file at startup of your application.
-
Put my back.jpg into the project directory, still the same thing.
Also this is integrated into Win32, the output you speak of I do not have.
EDIT:
Well, i found a solution, the name of my exe was "render test.exe" so i changed it to render.exe and now it shows the jpg perfectly.
Aka, It doesn't like the spaces and i just realised i've never seen a exe with spaces like that.
-
redirect std::cerr to a file at startup of your application
It won't help much, SFML 2 doesn't use std::cerr, it uses a stream with custom streambuf writing to stderr. This - sf::Err() - is the stream that should be redirected.
Also... standard output (stdout) != standard error output (stderr). SFML uses the latter for error messages, not the former.
-
I know this is an old topic, but I have the same problem with the SFML 2.0 RC.
sf::Texture bg;
if( !bg.loadFromFile( "data/card/frame2/acard.jpg" ) )
return EXIT_FAILURE;
It fails to load the jpg files... I don't know if this is normal, but I just converted my file acard.jpg to acard.png with paint and it works.
-
What is the error message?
-
Sorry for the late answer. The message I get in the console is "Failed to load image "data/card/frame2/acard.jpg". Reason : JPEG format not supported (progressive)".
Is this because it's a particular jpg format or is the jpg format not suported at all ?
-
Progressive JPEG format is not supported, so just convert it to a regular JPEG.