SFML 1.6 window closes unexpectedly

Started by
6 comments, last by wicked357 12 years, 2 months ago
My code compiles and runs find in code blocks, but when I try to run the exe files from the bin folder the window opens and closes in under a second. Any fixes?Do i have to tell the program to pause? Thanks guys
Advertisement
You should try a loop if you are doing SFML. Look at the tutorial for an idea. They use something like while the app is open, run, and on pressing the ESC key or the X for the window, it exits.

As for just seeing the window, a pause could show the window if you call it before you call return.
I have the loop and like I said it works fine if i run it within code blocks but not when i run the release .exe
Code would help us see your problem, probably.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
It could be a problem with execution directories and where it is trying to find things, if you are loading from files. When you run in Code::Blocks, the execution directory might not be where the .exe is actually located. Also ensure that the SFML DLLs are where the .exe can find them.
ok all of the DLLs are in the release folder and I can see that the window opens but closes right afterwards
Ok I found the problem, but my last question would be is there a way to include the images, fonts, ect. That are needed for the program to run be included in the .exe
This might be a little more practicle to use something like PhysicsFS it is a way to use your content that is put into an archive file and easily intergrated with SFML. I made a wrapper class for it but not sure if I still have that I will look if that helps you out. Also it doesn't have to have the conventional .zip you could make your extension be .dat or whatever you want it to be. I hope that helps you with the last question.

This topic is closed to new replies.

Advertisement