vendredi 20 novembre 2020

a c++ gdb debugging program with -std=c++11 not working

Here is my code

int main() {
    int n = 4;
    vector < vector<int> > obs = {
        {4, 1}, {1, 4}, {2, 4}, {3, 2}
    };
    int cells = 0;
    cells = remove_dup(obs);
    return 0;
}

If i compile and run it without debugging it throws no error

g++ -c program_name.cpp -std=c++11
g++ -o program_name program_name.cpp
./program_name

the above 3 cmds work fine.

But when i use gdb debugger it throws an exception.

g++ -std=c++11 -g program_name.cpp
gdb program_name
start

then i use step cmd 6 times, then it throws this error

std::allocator<int>::allocator (this=0x7fffffffdc39)
at /usr/include/c++/5/bits/allocator.h:113
113       allocator() throw() { }

next step cmd takes to some allocation problem. what i know of this is that, gdb with std=c++11 is not set properly.

can someone help me, thanks in advance.

Aucun commentaire:

Enregistrer un commentaire