Sign in to follow this  
password

Troublesome error

Recommended Posts

Don't really know if I should post about this at all, but i'm really stuck now and don't know what to do anymore because of this. I've been coding a rpg in 2d with c++ and sdl for the past weeks. Everything has gone smoothly until now when I just changed the coordinates for a certain graphic on a sprite sheet (which is supposed to work). The fences I made from the game was not good enough, so I changed them and gave them a new position on the sprite sheet. I changed all the coordinates to the new ones and somehow it can't show them, so I changed back to the old position and now something that is not even supposed to be shown is shown. When I coincidentally went to the project folder I saw the stderr.txt file and when that file is there it always is that annoying error: "Fatal signal: Segmentation Fault (SDL Parachute Deployed)". What's even more troublesome is that I don't know when I got that error because it hasn't complained about it when i've tested the game, it have been working perfectly. Otherwise when the Parachute Deployed error appears the program won't open at all (black screen and exit), but this time it don't do that in any way. Now i'm stuck here with about 3000 lines of code, pretty sure that everything is coded right also completely unknowing when the Parachute error appeared and how it appeared. can it be worse? Is there any way to find errors like this easily? why can't it show the line number/numbers that is causing this error?

Share this post


Link to post
Share on other sites
Hello,

I must admit that I can't help you to solve your problem - it seems to be complicated. Anyway, I can help you in another way.

1) Never ever say that you are "pretty sure that everything is coded right". The computer is not clever enough to invent his own problems. It means that if somethign goes wrong, it is your fault, not the computer's fault. In your case, you are making SDL cry. SDL is well tested, so if you have an internal SDL error, it means that you have feed SDL with something wrong.

2) When you learn programming, the first thing you should learn is how to debug your program. In fact, when I gave some "New to C++" course to some clients at the beginning of the year, the first session was something like "Write your own hello world program and debug it".

You are lucky, your program is only 3000 lines long. It means that you can easily debug the program by evaluating each instruction (and looking at the parameters you give it). It might be even easier since you know that you are doing something wrong with SDL - meaning that you can put a breakpoint on each SDL call and verify the parameters values.

HTH,

Share this post


Link to post
Share on other sites
Oh, that sounds pretty tough to do, always wondered what the breakpoints were used for. I atleast know that the parachute error has appeared before, for example when I deleted a vector that was used a last time after it was deleted.

Thanks for your tips, will see what I can do. The coordinate problem is cleared up atleast, it was because I saved the file in another folder.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this