C++ Debugging in Eclipse CDT on Linux
This post is a reminder to myself, and maybe help others, how I managed to get Eclipse CDT to work meaningfully with gdb for debugging.
Eclipse – in its default state with CDT – often there is not visibility into vectors and more complicated containers when you’re debugging. You get to see the vectors, with an error that the Internet says “is as designed”. (In a future update, I’ll include the error. But for now, I’m just happy with a solution.)
I think this is due to missing flags (-g3) when compiling. Sorting this out is less important that finishing my college courses though.
The issue seems to be in how you create the C++ project in Eclipse.
To make it work:
(1) In Eclipse, in the Project Explorer, right-click in a blank area, and select New -> Project. (Not C/C++ Project!)
(2) In the “Select a wizard” prompt, In the C/C++ folder, select “C++ Project”.
(3) In the next dialog, select Linux GCC as your toolchain.
Add new cpp source files, or edit the Hello World it gives you, build the project, and debug it, now meaningfully.