Jump to content
Science Forums

Recommended Posts

Posted

The program I'm using uses a makefile to compile (not written by me no idea of how to do this...), now I changed the program a bit around and get a segmentation fault. For this reason I would like to use gdb for debugging, but to have its full functionality (for example line numbers) I would need to compile with g++ with the option -g. Is this right?

 

So far it seems anyway the fault occurs in the gsl-files so backtrace won't bring much even if I have line numbers, because for it is not the gsl files having a bug, but mine... I just thought having all the symbol tables would give a bit more chances to find the bug...

 

EDIT: in case the Makefile can be found in the cmbeasy code downloadable from CMBEASY

Posted

First try the g++ -ggdb infile -o outfile

Then if there is an error in linking try a -lm option at the end of the line.

And you dont ignore warnings if you get them, use a -Wall option to see all the warnings that come up during your compile, and try really hard to fix them.

 

and then finally if none of that fixes the issue, try to iterate through your program with gdb, hopefully it will narrow down where the mistake is...

Posted

Yesterday I went to see one of my profs and that is actually what we did somewhere in the makefile there were some FLAGS defined conaining already -Wall etc and we just added -ggdb. Thanks very much anyway.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...