Segmentation Fault...? Outta nowhere

I am starting to understand how to make very simple games with SDL.
Then when I was done comiling fixing up my errors and all, it always
does the same Segmentation Fault at the same place. I tried to dubug
it, but it was at the place I’d least expect it. I made a object
(not a pointer) from my sprite class (not actually mine but i fully
understand it), tried to initialize it and it dies right after that.
The picture is fine, the sprite class is fine, and I’m almost sure
it’s not my newbieness. What the hell? I use Dev C++ 5, teh most
recent SDL and SDL_mixer and I have a good new computer with a 128MB
nVidia card. Any help woul be appreciated!

pkmn_qwerty12 wrote:

I am starting to understand how to make very simple games with SDL.
Then when I was done comiling fixing up my errors and all, it always
does the same Segmentation Fault at the same place. I tried to dubug
it, but it was at the place I’d least expect it. I made a object
(not a pointer) from my sprite class (not actually mine but i fully
understand it), tried to initialize it and it dies right after that.
The picture is fine, the sprite class is fine, and I’m almost sure
it’s not my newbieness. What the hell? I use Dev C++ 5, teh most
recent SDL and SDL_mixer and I have a good new computer with a 128MB
nVidia card. Any help woul be appreciated!

Hi,

you really should send some code. I guess everyone has had weird
segfaults in their lives, and they really appear unpredictably.
In the mean time, check that you (and the sprite class and so on) access
valid memory.

Sebastian

— In libsdl at yahoogroups.com, Sebastian Beschke <s.beschke at g…>
wrote:

pkmn_qwerty12 wrote:

I am starting to understand how to make very simple games with
SDL.

Then when I was done comiling fixing up my errors and all, it
always

does the same Segmentation Fault at the same place. I tried to
dubug

it, but it was at the place I’d least expect it. I made a object
(not a pointer) from my sprite class (not actually mine but i
fully

understand it), tried to initialize it and it dies right after
that.

The picture is fine, the sprite class is fine, and I’m almost
sure

it’s not my newbieness. What the hell? I use Dev C++ 5, teh most
recent SDL and SDL_mixer and I have a good new computer with a
128MB

nVidia card. Any help woul be appreciated!

Hi,

you really should send some code. I guess everyone has had weird
segfaults in their lives, and they really appear unpredictably.
In the mean time, check that you (and the sprite class and so on)
access
valid memory.

Sebastian

I’m SURE I’m not adressing anything wrong! Because I’m not even
using pointers at that point yet. To make sure I even initialized
them all to NULL in for loop Right at the biginning! Well where do I
send the code? It’s too long (and made of multiple files!)

You could upload it to some site and post a link.
For finding the evil segfault, try a debugger (gdb for example) and a
memory debugger (like valgrind, http://valgrind.kde.org). Don’t know any
programs for windows, though.

BTW: If I understood your text correctly, you first wrote all of the
code and then compiled it. Maybe you should next time try to make
smaller steps (immediately compile and try it after you have changed
anything), so it’s easier to track down bugs. Just in case you didn’t know.

Bernhard

pkmn_qwerty12 wrote:> — In libsdl at yahoogroups.com, Sebastian Beschke <s.beschke at g…>

wrote:

pkmn_qwerty12 wrote:

I am starting to understand how to make very simple games with

SDL.

Then when I was done comiling fixing up my errors and all, it

always

does the same Segmentation Fault at the same place. I tried to

dubug

it, but it was at the place I’d least expect it. I made a object
(not a pointer) from my sprite class (not actually mine but i

fully

understand it), tried to initialize it and it dies right after

that.

The picture is fine, the sprite class is fine, and I’m almost

sure

it’s not my newbieness. What the hell? I use Dev C++ 5, teh most
recent SDL and SDL_mixer and I have a good new computer with a

128MB

nVidia card. Any help woul be appreciated!

Hi,

you really should send some code. I guess everyone has had weird
segfaults in their lives, and they really appear unpredictably.
In the mean time, check that you (and the sprite class and so on)

access

valid memory.

Sebastian

I’m SURE I’m not adressing anything wrong! Because I’m not even
using pointers at that point yet. To make sure I even initialized
them all to NULL in for loop Right at the biginning! Well where do I
send the code? It’s too long (and made of multiple files!)


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl