Hello everybody i am having a problem with SDL, when i compile and run my game with the IDE it works just perfect, but when i ty to run the .exe aplication, it apear a black screen for 1 sec and then it crash! i am using Dev-C++ as IDE, i added al the DLL's to the file
please Help!!!
As you can see i have the images directorys defined in the code, but the exe is not in the images and maps folders, is in the engine folder.
Try setting breakpoints, stepping through your code, or adding some debug logging everywhere that an error condition is returned or acted upon, like so:
fprintf(stderr, "Some shit hit the fan in load_image when loading tiles.png\n");
Also, you should fix your directories and use relative paths if you think you might ever move the project folder to a different location or give your game to anyone else. Absolute paths are, in all but the most extreme of cases, terrible ideas.
Yes i add debugg stuff in the code and the problem is loading the files (player, tiles) but i cant fix it!!, its interesting that when i compile and run it from the compiler it load the files perfect, the problem is the exe!
lalacomun wrote:Yes i add debugg stuff in the code and the problem is loading the files (player, tiles) but i cant fix it!!, its interesting that when i compile and run it from the compiler it load the files perfect, the problem is the exe!
If it's a SDL function that's failing, log the error message from SDL. SDL and its addons provide *_GetError() messages, where * is SDL, IMG (for SDL_image), Mix (for SDL_mixer), or TTF (for SDL_ttf). So if IMG_Load() is failing, do this:
SDL_Surface *image = IMG_Load(filename);
if (!image) {
fprintf(stderr, "IMG_Load(%s) returned NULL; SDL_image said '%s'\n", filename, IMG_GetError());
return NULL;
}
You're providing very little information on the specifics of your problem. Just saying that the problem is loading the files and that you can't fix it doesn't give us the necessary details to help you. You've provided us with one function that very simply calls another function (load_image()), but not the source to the function where the actual work is being done--and therefore, likely where the error is happening.
lalacomun wrote:Well i get to the conclusion That Dev-C++ SUCKS!
I think that's the general consensus among most people on this forum.
"Do I really have to spell this out? What if a bunch of punk kids go into the woods with a bullet proof vest and strap it on a grizzly bear? Then what have you got? Invincible bears. Is that what you want? Invincible bears running around; raping your churches and burning your women?"
lalacomun wrote:Thanx for all your help the problem were these 2 damn dlls : libpng12-0.dll and zlib1.dll
Ahh yes. I've forgotten to put those in the folder so many times. Without them, nothing works yet no error.. perhaps there's a way to error-check that in the code.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
short wrote:Ah, I promise if you keep at it you'll get to the point where you recognize the runtime error as a missing dll.
But it would still be a good idea, in chase the player somehow screwed up and removed a dll from the folder. "Hey, you are missing this dll"
In my experience, most of my chases of missing dll's, I've got a message box that tells me I'm missing a dll. But some dll's wont give me that error message, so I have to figure it out myself.
short wrote:Ah, I promise if you keep at it you'll get to the point where you recognize the runtime error as a missing dll.
But it would still be a good idea, in chase the player somehow screwed up and removed a dll from the folder. "Hey, you are missing this dll"
In my experience, most of my chases of missing dll's, I've got a message box that tells me I'm missing a dll. But some dll's wont give me that error message, so I have to figure it out myself.
Hell yes!
short wrote:Ah, I promise if you keep at it you'll get to the point where you recognize the runtime error as a missing dll.