Received: from PACIFIC-CARRIER-ANNEX.MIT.EDU by po7.MIT.EDU (5.61/4.7) id AA19317; Sat, 9 Mar 96 02:40:09 EST
Received: from YAZ-PISTACHIO.MIT.EDU by MIT.EDU with SMTP
	id AA24429; Sat, 9 Mar 96 02:39:28 EST
Received: by yaz-pistachio.MIT.EDU (5.57/4.7) id AA02623; Sat, 9 Mar 96 02:40:08 -0500
Message-Id: <9603090740.AA02623@yaz-pistachio.MIT.EDU>
To: Steve Niemczyk <sniemczy@MIT.EDU>
Cc: proven@MIT.EDU
Subject: Re: SunOS 4.1.3 and libg++ 
In-Reply-To: Your message of "Fri, 08 Mar 1996 06:12:30 EST."
             <01BB0CB6.3C906DA0@ISLANDER.MIT.EDU> 
Date: Sat, 09 Mar 1996 02:40:06 EST
From: Christopher Provenzano  <proven@MIT.EDU>


> hi.  Me again :-)  I finally got access to the 4.1.3 machine that I was 
> promised, and I build gcc, pthreads, libg++, gmake, etc. on it 
> successfully.
> 
> I was able to run simple "helloworld.cxx" style programs using gcc (no 
> iostream classes) g++ (with iostream classes), yet unusual behavior with 
> the pg++ classes.
> 
> It turns out that whether I build libg++ ENTIRELY from pgcc (aka, I never 
> installed libg++ until after I installed pthreads, and with the "CC=pgcc 
> -O2" and "CXX=pgcc" options turned on) or if I make a normal libg++ in 
> /usr/local/ and put a special version of libg++ somewhere, it still 
> core-dumps...
> 
> I can get the code to compile if I use the standard libg++ libraries, 
> compiled without pgcc, but the code does nothing, or Seg faults :-(
> 
> Here is the program:
> 
> #include <stdio.h>
> #include <pthread.h>
> #include <iostream.h>
> 
> void main()
> {
>         printf("Hello World\n");
>         cout << "Hi Mom!" << endl;
>         cout << "Enter a number:";
>         int x = 5;
>         cin >> x;
>         cout << "Wow!  You chose " << x << '!' << endl;
> }
> 
> here is the output:
> 
> sunny <~/testc++>: a.out
> Hello World
> Segmentation fault (core dumped)
> 
> Any ideas?
> 
If you use a libg++ not build with pgcc then cout and cin will use the
SunOS version of stdio while printf will be the pthread version. Since
the stdios are different and incompatible the core dump is expected.

CAP
