Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 May 1997 18:48:47 +1000
From:      David Nugent <davidn@labs.usn.blaze.net.au>
To:        Chris Coleman <chris@bb.cc.wa.us>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: 3.0-050297-SNAP C++ Problem. 
Message-ID:  <199705120848.SAA03667@labs.usn.blaze.net.au>
In-Reply-To: Your message of "Thu, 08 May 1997 13:32:23 MST." <Pine.NEB.3.94.970508132720.5196A-100000@aries.bb.cc.wa.us> 

next in thread | previous in thread | raw e-mail | index | archive | help
> I am writing a program in C++ and everything was working fine on FBSD
> 2.1.7.  Then when I upgraded to 3.0-SNAP my program wouldn't make.  It
> gave me linker errors missing things like "_cout" and the other C++ Stream
> stuff.  I removed the libg++.so.4.0 library temporarily  and compiled the
> program again.  It compiled, but now when I try to declare a fstream
> variable the program crashes and core dumps.  Any help would be
> appreciated.

Put libg++.so.4.0 and add -lstdc++ to the command line.

All you achieve by removing libg++.so.4.0 is to either link
against the static version of the library or worse, an older
version of libg++.

davidn@labs[~]> cat fstest.cc
// fstest.cc
#include <fstream.h>

int
main(void)
{
  ofstream file("testing");

  file << "Hello, this is a test" << endl;
  return 0;
}
davidn@labs[~]> gcc -O -o fstest fstest.cc -lstdc++
davidn@labs[~]> ls -lF fstest*
-rwxr-xr-x  1 davidn  davidn  13712 May 12 18:43 fstest*
-rw-r--r--  1 davidn  davidn    141 May 12 18:42 fstest.cc
davidn@labs[~]> ./fstest
davidn@labs[~]> cat testing
Hello, this is a test
davidn@labs[~]> _


iostream used to be part of libg++, but has now moved to stdc++,
along with all of the other c++ standard classes (mainly stl).

Regards,
David


David Nugent - Unique Computing Pty Ltd - Melbourne, Australia
Voice +61-3-9791-9547  Data/BBS +61-3-9792-3507  3:632/348@fidonet
davidn@freebsd.org davidn@blaze.net.au http://www.blaze.net.au/~davidn/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705120848.SAA03667>