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

Author Topic: Problem with sfml 2.0 rc - compiling but not working -  (Read 10884 times)

0 Members and 2 Guests are viewing this topic.

zaedas99

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Problem with sfml 2.0 rc - compiling but not working -
« on: April 30, 2012, 07:37:57 pm »
Hey guys, gals,

Here is a video that i've done which produce the problem :




I'm using the statics libraries with debug function with the "short example" here : http://sfml-dev.org/documentation/2.0/

As you can see, everything is compiling, but it closes instantly. I've ran the program into debugging mode, and it would seems that it doesn't like a lot those if statements that check whether or not the file is readable/access-able. Each time i've ran the debugger, it enters the if which return "exit failure".

I've checked every single path to the files in question and i've not found a single mistake that could lead to problems... You can see for yourself in the video.

If you could tell me wth i'm doing wrong, i would be thankful.

Zaedas

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Problem with sfml 2.0 rc - compiling but not working -
« Reply #1 on: April 30, 2012, 08:19:55 pm »
Can you tell us which resource fails to load? Does it work with absolute paths?

You should enable the console, so that you can see the error messages.
Laurent Gomila - SFML developer

zaedas99

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Problem with sfml 2.0 rc - compiling but not working -
« Reply #2 on: April 30, 2012, 08:35:30 pm »
Of course,

It fails to load any graphics/fonts.

If i put both the picture and font code between comment tag, the window opens and plays the song correctly.

Anything else, it just crashes.


i've also tried the absolutes paths as you suggested, but the same problem arise.

This might be a newbie question, but how do you enable the console?

Thanks,

zaedas
« Last Edit: April 30, 2012, 08:47:27 pm by zaedas99 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Problem with sfml 2.0 rc - compiling but not working -
« Reply #3 on: April 30, 2012, 08:50:34 pm »
Quote
Anything else, it just crashes.
Don't say "crash" if it returns cleanly after a failure. It's misleading for people who try to figure out what's happening in your code :)

Quote
This might be a newbie question, but how do you enable the console?
Google would have answered faster, for this kind of question ;)

Project settings > Linker > System > Sub-system : console
Laurent Gomila - SFML developer

zaedas99

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Problem with sfml 2.0 rc - compiling but not working -
« Reply #4 on: April 30, 2012, 09:35:59 pm »
Quote
Anything else, it just crashes.
Don't say "crash" if it returns cleanly after a failure. It's misleading for people who try to figure out what's happening in your code :)

My bad, i said "crash" because for me it looks like "trying to open", but cannot. Therefore, that's why i said crash xD :-\.

As for the console, you are more than right about google. XD. Often we seek an answer that is right under our noses, isn't it?

Anyway, after activating it, it says "failed to load image "textures/cute_image.jpg". Reason : unable to open file.

Thank you for your help, i appreciate a lot :).

P.S : As a side question, does the transparency from pngs are natively supported?

« Last Edit: April 30, 2012, 09:37:33 pm by zaedas99 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Problem with sfml 2.0 rc - compiling but not working -
« Reply #5 on: April 30, 2012, 10:47:58 pm »
Quote
Anyway, after activating it, it says "failed to load image "textures/cute_image.jpg". Reason : unable to open file.
So there's definitely something wrong about the file path.

Quote
As a side question, does the transparency from pngs are natively supported?
Yes.

By the way, why have you duplicated all the loadFromFile calls?
Laurent Gomila - SFML developer

zaedas99

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Problem with sfml 2.0 rc - compiling but not working -
« Reply #6 on: April 30, 2012, 11:15:46 pm »
Quote
So there's definitely something wrong about the file path.

Now that's weird, because i've tried to put every ressources in the "root" folder (directly where the .exe is) and i still have the same problem. Instead of "textures/cute_image.jpg" reason : could not open file, i have "cute_image.jpg" reason : could not open file. I'm clueless right now :S.

Quote
By the way, why have you duplicated all the loadFromFile calls?

I thought at first that something was wrong with the if statements, that's why i duplicated them. It would seems that i forgot to delete them.

thanks again for the help.

zaedas

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re: Problem with sfml 2.0 rc - compiling but not working -
« Reply #7 on: May 01, 2012, 01:00:52 am »
Now that's weird, because i've tried to put every ressources in the "root" folder (directly where the .exe is) and i still have the same problem. Instead of "textures/cute_image.jpg" reason : could not open file, i have "cute_image.jpg" reason : could not open file. I'm clueless right now :S.

I don't use VS but with C::B the exe file path ISN'T the right path when you launch your app directly with the IDE.

What if you try to double click directly the exe ?

zaedas99

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Problem with sfml 2.0 rc - compiling but not working -
« Reply #8 on: May 01, 2012, 01:48:29 am »
Now that's weird, because i've tried to put every ressources in the "root" folder (directly where the .exe is) and i still have the same problem. Instead of "textures/cute_image.jpg" reason : could not open file, i have "cute_image.jpg" reason : could not open file. I'm clueless right now :S.

I don't use VS but with C::B the exe file path ISN'T the right path when you launch your app directly with the IDE.

What if you try to double click directly the exe ?

I already tried that. The problem is still there :S. (i've in fact tried it in the video i uploaded in my first post)

thanks for replies :)

zaedas99

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Problem with sfml 2.0 rc - compiling but not working -
« Reply #9 on: May 01, 2012, 03:56:08 pm »
*bump*

zaedas99

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Problem with sfml 2.0 rc - compiling but not working -
« Reply #10 on: May 01, 2012, 08:07:21 pm »
I've tried to change all libs to non-static, but the same problem arise.

Also, once again, i tried to launch my program while commenting some parts of the code, and the music is found without any problem by the application. However, it would seems that both the font and the graphics are not working..

I really need help on this one.

thanks,

zaedas

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Problem with sfml 2.0 rc - compiling but not working -
« Reply #11 on: May 01, 2012, 08:12:05 pm »
Could you zip and upload your exe + resources, so that we can try it?
Laurent Gomila - SFML developer

zaedas99

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Problem with sfml 2.0 rc - compiling but not working -
« Reply #12 on: May 01, 2012, 09:15:22 pm »
Could you zip and upload your exe + resources, so that we can try it?

Sure! here you go : http://www.mediafire.com/?ffsjrdbhdsb5h21

I uploaded the .exe + dlls/ressources, and the main.cpp file.

Note : I did not include the file "nice_music.ogg" since it was 10mb.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Problem with sfml 2.0 rc - compiling but not working -
« Reply #13 on: May 01, 2012, 10:51:07 pm »
Arg... you have ";" after your "if"s.
Laurent Gomila - SFML developer

zaedas99

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Problem with sfml 2.0 rc - compiling but not working -
« Reply #14 on: May 02, 2012, 03:55:31 am »
Are you kidding me? =_=.

I don't remember putting ";" after ifs since i copy-pasted the code. But whatever, that's still stupid coming from me. I didn't see at all :O.

*hides*

P.S : That's weird though, did you try to compile and run it? Was it working? I swear it wasn't working from the very start, even without those ";"

Anyway i'm sorry. I'll remember to check that out next time XD.

zaedas