Debugging Custom C++ Types in Codeblocks (Code::Blocks)

  • Posted on: 14 December 2014

When I develop C++ on Linux, and I'm not in a purist/makefile/command-line mood, I like to use Code::Blocks. It doesn't quite have the feature set that Eclipse does, but Eclipse always feels a bit cumbersome to me. On the flipside, Code::Blocks seems much more lightweight.

In this article, I'm going to explain how to debug custom types with Code::Blocks. First, let's look at a motivating example. Here's a cpp file that defines and uses a simple array class, myarray:

#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <cstdlib>

class myarray

    myarray(int sz):
        arr( new double[sz] )

    ~myarray(){ delete[] arr;}

    double* arr;
    int     n;


int main ()
    std::cout << "custom type test" << std::endl;

    int n = 5;

    myarray the_array(5);