Code for Concinnity

beautiful and elegant solutions


Eclipse CDT hangs in OS X all the time — the solution

The solution — download 32-bit Eclipse. Works like a charm. Kind of anti-climatic :P

Published by kizzx2, on July 4th, 2011 at 1:37 am. Filled under: Uncategorized1 Comment

“Pretty-printing” STL vector in Eclipse CDT

It’s surprising to see why the C++ debugging scene in Mac/Linux is so behind Visual Studio. One definite strengths of MSVS is the ability to display STL vectors as arrays in the debug view.

If you’re using Eclipse CDT on Mac, you’re probably stuck with GDB 6.8 which doesn’t come with pretty printing. I tried self building GDB 7.2 but Eclipse CDT 8.0 doesn’t seem to be able to interact well with it (please someone come and correct me if I’m wrong).

So here’s how to display std::vector nicely even if you’re using GDB 6.8:

As you can see, the trick is to convert it to a pointer and to use the array syntax *((int*)nums) @ 3

Enjoy :)

Published by kizzx2, on July 3rd, 2011 at 12:37 pm. Filled under: Useful tips Tags: 1 Comment