[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
C++ vectors
From: |
Michael D. Hartl |
Subject: |
C++ vectors |
Date: |
Mon, 30 Dec 2002 18:56:03 -0800 (PST) |
Hi Holly,
Your question regarding using DDD with C++ vectors is the first Google hit
when searching on "ddd c++ vectors". I don't know if you are still
interested (you posted a year and a half ago), but for the benefit of
people like me who searched for an answer I thought I'd post a response.
I had trouble looking at the contents of C++ STL vectors with DDD inside
my subroutines. (Vectors inside main worked fine.) When printing the
element (say) v[0],
(gdb) p v[0]
I got the error message
cannot subscript something of type `vector<double,allocator<double> >'
I dumped the error message into Google, and I found the answer at
address@hidden: compiling with the -ggdb flag in place of plain -g did
the trick.
g++ -ggdb -o foo foo.cpp
Voila. Now printing v[0] shows the value of the vector element just as if
it were a C array.
Hope this helps,
Michael
--
Michael Hartl
http://www.michaelhartl.com/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- C++ vectors,
Michael D. Hartl <=
- Prev by Date:
News
- Previous by thread:
News
- Index(es):