Jump to content
  • Advertisement
Sign in to follow this  
antaeus88

[help]Segmentation fault

This topic is 3036 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I used to compile and run NEHE lessons in Linux, it worked quite well( I had gcc, mesa, X configured correct).

But today when I run my complied lessons:

double click, no response.
type in ./lesson2 in terminal and enter,
terminal said "Segmentation fault"

what's wrong? Help me. New semester begins I need to do homework;( PLZ help

Share this post


Link to post
Share on other sites
Advertisement
But I didn't make any change.

I tried to redownload the lessons from HEHE.
After Compilation is ok, there still have this segmentation fault.
I don't know.

Share this post


Link to post
Share on other sites
Run the program in GDB. Your going to have to learn how to debug this sort of thing at somepoint. A segmentation fault can be caused by all manner of code or data issues, since it just means a general memmory issue. Compile with -g, and GDB should be able to give you a good stack trace (bt command) to show you the function it crashed in. Using the frame command you can step it up to the function in your code, where a list will show the line that caused the problem.

Share this post


Link to post
Share on other sites
Quote:
Original post by antaeus88
But I didn't make any change.


Then there is something wrong with what you were given.

You cannot learn to program by copying things and watching them work. Even when they do actually work.

Quote:
New semester begins I need to do homework


What does that have to do with anything?

Share this post


Link to post
Share on other sites
We can't tell. It could e.g. be that you trash a memory region that is accessed by a function called later in the process. Sometimes bugs are very hard to track down. It could also be that you pass invalid values to some functions. It could even be that the thread in question doesn't cause that bug, but another thread started by you invokes an even subtler error whose face is shown in the main-thread. We can't tell.

You need to show source-code.

Quote:
HEHE

It is named "NEHE", not HEHE. HEHE is a german "heh".

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!