This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

<incomplete type> in a C++ program compiled with gcc 4.0.1


Hi all!

This is my first post to this mail list, and I'm not sure if it is the correct one. In case I'm wrong, can you please tell me wich mail list is the correct one?

I have this C++ program:

------------------------------------------
/*
g++ -g -o tgdb tgdb.cc -lstdc++
*/
#include <sstream>
#include <iostream>

int main()
{
   std::stringstream a_example("I want to see this in gdb!");
   std::cout <<  a_example.str() << std::endl;
}
------------------------------------------

The program works as expected, but when I run it in GDB setting a breakpoint in the "cout" line, I cannot print the content of "a_example".
Here is the output of gdb:


(gdb) p a_example
$1 = <incomplete type>

(gdb) what a_example
type = stringstream

(gdb) ptype a_example
type = struct std::basic_stringstream<char,std::char_traits<char>,std::allocator<char> > {
<incomplete type>
}



My gcc is:
$ g++ -v
Using built-in specs.
Target: i586-mandriva-linux-gnu
Configured with: ../configure --prefix=/usr --libexecdir=/usr/lib --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --enable-languages=c,c++,ada,f95,objc,java --host=i586-mandriva-linux-gnu --with-system-zlib --enable-long-long --enable-__cxa_atexit --enable-clocale=gnu --disable-libunwind-exceptions --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --enable-gtk-cairo --disable-libjava-multilib
Thread model: posix
gcc version 4.0.1 (4.0.1-5mdk for Mandriva Linux release 2006.0)


And my gdb is:
$ gdb -v
GNU gdb 6.3-5mdk (Mandriva Linux release 2006.0)
Copyright 2004 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-mandriva-linux-gnu".


As you can see, I have used "g++ -g -o tgdb tgdb.cc -lstdc++" to compile the program.

Am I doing something wrong?
Why can't I see the contents of "a_example"?

Here (http://tinyurl.com/ynzagc) I have found a similar problem, but I really don't understand the way it is resolved.

Any ideas will be much appreciated.

Thank you very much,
Raúl.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]