Re: cout/c++
Don Hatch (hatch++at++hell)
Wed, 14 Feb 1996 19:20:45 -0800
On Feb 14, 4:25pm, Wing Ho Kong wrote:
> Subject: cout/c++
>
> I've just started using Performer 2.0, and I'd like to know why I get this
> error:
>
> "Segmentation fault (core dumped)"
>
> if I use "cout" in a Performer program. Even if I don't make Performer calls
> (or include Performer header files), the program crashes as soon as it hits a
> cout command.
>
> I use the makefile that's in /usr/share/Performer/src/pguide/libpf/C++.
> Here's the standard output I get:
> *******************************************
> athos 22% make simple
>
> making IrisGL DSO version of simple.igldso
> /usr/bin/CC -xansi -DIRISGL -nostdinc -I/usr/include/CC
> -I/usr/include -O -Olimit 2000 -MDupdate Makedepend -c ../simple.C
> /usr/bin/cc -xansi -DIRISGL -nostdinc -I/usr/include -O -Olimit
> 2000 -MDupdate Makedepend -woff 515,608,658,799 -o simple.dsocmd simple.o
> -L/usr/lib -L/usr/lib/libpfdb -L/lib -all -ignore_unresolved -lpf_igl
> -lpfdu_igl -lpfui -lpfutil_igl -lmpc -limage -lfm -lgl -lXirisw -lXm -lXt
> -lfpe -lXmu -lX11 -lm -lmalloc -lC
> making symbolic links to DSO versions
> ln -s OPT.O32.IRISGL/simple.dsocmd simple ;
> `simple' is up to date.
>
> ******************************************
>
> Well, I've gone this far, so here's the source file :)
>
> #include <iostream.h>
> void main (void)
> {
> cout << "test\n";
> }
>
>
> Anyways, I've never had this problem with 1.2 before.
>
> thanks,
>
> wk
Any program that uses iostreams must be linked with CC rather than cc
so that the initialization object Iostream_init
will be constructed (see iostream.h).
In fact, any program that has any static or external C++ objects with
constructors must be linked with CC instead of cc.
None of the examples use iostreams (which is why we didn't notice the problem),
but the Makefiles in the C++ example directories should be changed to use
$(CXX) instead of $(CC).
Don
--
Don Hatch hatch++at++sgi.com (415) 933-5150 Silicon Graphics, Inc.
This archive was generated by hypermail 2.0b2
on Mon Aug 10 1998 - 17:52:24 PDT