I'm trying to debug a small program I've written in C. I open up the file in emacs, M-x gdb, give the program filename (a.out). When i switch to the source file in the emacs pane, and try to place a breakpoint in the main function, I get the message "No defau开发者_开发知识库lt breakpoint address now." and the breakpoint doesn't place, so I can't debug the program. I'm compiling the program with the options gcc -Wall -ansi -pedantic-errors -Werror. Any ideas?
to debug in gdb you have to use the -g option, this will let gdb work with your output file by adding debugging symbols to your binary
gcc -g file.cpp
精彩评论