Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* <incomplete type> in a C++ program compiled with gcc 4.0.1
@ 2006-11-10 19:07 Raúl Huertas
  2006-11-10 19:11 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Raúl Huertas @ 2006-11-10 19:07 UTC (permalink / raw)
  To: GDB maillist

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.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-11-10 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-10 19:07 <incomplete type> in a C++ program compiled with gcc 4.0.1 Raúl Huertas
2006-11-10 19:11 ` Daniel Jacobowitz
2006-11-10 19:24   ` Raúl Huertas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox