[Converted from Gnats 647] when i try to debug this short program, i can't access a[0] or a[1]. i'm new at this, so i might be doing something wrong. #include <vector> main(){ vector<int> a; a.push_back(1); a.push_back(132); } Release: 5.1.1 Environment: Linux fast.hn 2.4.19-rc1-ac3-gentoo-r1 #1 Wed Jul 24 14:48:12 UTC 2002 i586 GenuineIntel GNU gdb 5.1.1 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i586-pc-linux-gnu". Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.3/specs gcc version 2.95.3 20010315 (release) How-To-Repeat: compile the program (included in description field) like: g++ -g file.cpp gdb ./a.out break main next until the } appears print a print a[0] print a[1]
This works with recent gcc and gdb. You have to make sure that operator[] is instantiated, by referring to it in your program.