gdb Could not find operator[]

My understanding is that the compiler/linker includes only the member functions present in the source code and those are the ones I can use in gdb.

Your understanding is incorrect / incomplete.

std::vector is a template class. Without explicit instantiation, the compiler is required to instantiate only the methods called (usually a subset of methods present in the source).

Is there a way to include every member function of std::vector so I can access them in gdb?

For a given type T, you should be able to explicitly instantiate entire vector for that T, by requesting it, e.g.:

template class std::vector<double>;

Leave a Comment