Reputation: 2297
I am trying to debug a C++ program using Eclipse CDT:
#include <vector>
using namespace std;
int main() {
vector<int> test (4,100);
return 0;
}
If I place a breakpoint to debug, and I click "Display as Array..." for my vector variable I get the following error:
(*((test)+0)@4) Error: Multiple errors reported.\ Failed to execute MI command: -var-create - * (*((test)+0)@4) Error message from debugger back end: No symbol "operator+" in current context.\ Unable to create variable object
How can I view the values of my arrays while debugging?
I am using:
-g3
and -O0
)Upvotes: 3
Views: 2506
Reputation: 22701
Eclipse can, see the snapshot and the instructions here and here. This post helped me out as well.
Upvotes: 2
Reputation: 1
Dive a bit deeper into the structure of the std::vector
variable, and look for s.th. named _M_start
or alike (may be implementation dependent).
Cast this one to the final type array you know and want to see.
The reason is, that std::vector<T>
just wraps and manages an array of T
internally and thus can't be displayed as an array itself.
Upvotes: 1