Help with SDL!
Moderator: Coders of Rage
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Help with SDL!
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!!!
please Help!!!
- Teser0ck
- Chaos Rift Newbie
- Posts: 35
- Joined: Mon Aug 29, 2011 12:59 pm
- Current Project: Platformer game, Map editor, Particle system
- Programming Language of Choice: C++
- Location: Czech Republic
Re: Help with SDL!
Are you sure you have your images, music, etc. in the folder where's the .exe ? You should show us some code if this doesn't solve the problem.
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Re: Help with SDL!
here:
bool load_files()
{
dot = load_image( "C:\\Users\\nico\\Desktop\\proyecto engine-editor\\game\\Images\\dot.png" );
if( dot == NULL )
{
return false;
}
tileSheet = load_image( "C:\\Users\\nico\\Desktop\\proyecto engine-editor\\game\\Images\\tiles.png" );
if( tileSheet == NULL )
{
return false;
}
return true;
}
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.
bool load_files()
{
dot = load_image( "C:\\Users\\nico\\Desktop\\proyecto engine-editor\\game\\Images\\dot.png" );
if( dot == NULL )
{
return false;
}
tileSheet = load_image( "C:\\Users\\nico\\Desktop\\proyecto engine-editor\\game\\Images\\tiles.png" );
if( tileSheet == NULL )
{
return false;
}
return true;
}
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.
- Nokurn
- Chaos Rift Regular
- Posts: 164
- Joined: Mon Jan 31, 2011 12:08 pm
- Favorite Gaming Platforms: PC, SNES, Dreamcast, PS2, N64
- Programming Language of Choice: Proper C++
- Location: Southern California
- Contact:
Re: Help with SDL!
Try setting breakpoints, stepping through your code, or adding some debug logging everywhere that an error condition is returned or acted upon, like so:lalacomun wrote:here:
bool load_files()
{
dot = load_image( "C:\\Users\\nico\\Desktop\\proyecto engine-editor\\game\\Images\\dot.png" );
if( dot == NULL )
{
return false;
}
tileSheet = load_image( "C:\\Users\\nico\\Desktop\\proyecto engine-editor\\game\\Images\\tiles.png" );
if( tileSheet == NULL )
{
return false;
}
return true;
}
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.
Code: Select all
fprintf(stderr, "Some shit hit the fan in load_image when loading tiles.png\n");
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Re: Help with SDL!
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!
- Nokurn
- Chaos Rift Regular
- Posts: 164
- Joined: Mon Jan 31, 2011 12:08 pm
- Favorite Gaming Platforms: PC, SNES, Dreamcast, PS2, N64
- Programming Language of Choice: Proper C++
- Location: Southern California
- Contact:
Re: Help with SDL!
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: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!
Code: Select all
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;
}
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Re: Help with SDL!
Thanx for all your help the problem were these 2 damn dlls : libpng12-0.dll and zlib1.dll
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Re: Help with SDL!
Well i get to the conclusion That Dev-C++ SUCKS!
- jaybee
- Chaos Rift Newbie
- Posts: 27
- Joined: Thu Jan 13, 2011 12:53 pm
- Current Project: 2d platformer
- Favorite Gaming Platforms: NES, SNES, Genesis, DOS
- Programming Language of Choice: C++
- Location: Running Springs, CA
Re: Help with SDL!
I think that's the general consensus among most people on this forum.lalacomun wrote:Well i get to the conclusion That Dev-C++ SUCKS!
"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?"
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Help with SDL!
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.lalacomun wrote:Thanx for all your help the problem were these 2 damn dlls : libpng12-0.dll and zlib1.dll
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- short
- ES Beta Backer
- Posts: 548
- Joined: Thu Apr 30, 2009 2:22 am
- Current Project: c++, c
- Favorite Gaming Platforms: SNES, PS2, SNES, SNES, PC NES
- Programming Language of Choice: c, c++
- Location: Oregon, US
Re: Help with SDL!
Ah, I promise if you keep at it you'll get to the point where you recognize the runtime error as a missing dll.
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
link: https://github.com/bjadamson
- superLED
- Chaos Rift Junior
- Posts: 303
- Joined: Sun Nov 21, 2010 10:56 am
- Current Project: Engine
- Favorite Gaming Platforms: N64
- Programming Language of Choice: C++, PHP
- Location: Norway
Re: Help with SDL!
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"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.
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.
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Re: Help with SDL!
Hell yes!superLED wrote: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"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.
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.
I hope so !!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.