Debugging in Linux is really a very troublesome thing, debugging with GDB is not convenient, not in windows with VS cool, the main reason is because GDB is the command line form, in fact, under Linux there are some GDB-based graphical debugging tools.
1. kdbg
Under Ubuntu Direct sudo apt-get install kdbg can be installed.
If the MNG error 11:function is invalid on this point after starting up; Chunk Mhdr; Subcode 0:0 error, then delete/usr/share/kde4/apps/kdbg/icons/hicolor/22x22/actions/pulse.mng this file is good.
The interface is relatively friendly. The debugging method is simple:
1. First g++-G file.cpp or g++--debug file.cpp get the file a.out
2. Run kdbg Select file->excutable and then select A.out This file, the debug code will be loaded automatically.
3. Mouse point debugging Code The leftmost point in the left margin, turn red to set the breakpoint,
4. Press F5 to start debugging F10 step F6 jump out of F7 to mouse F8 follow up. View->locals can see variable data.
2. ddd
Similar to kdbg, select File-program to load the executable file.
Linux Form Debug Tool: Kdbg, DDD