home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!goanna!escargot!minyos.xx.rmit.OZ.AU!rcopg
- From: rcopg@minyos.xx.rmit.OZ.AU (Paul Gortmaker)
- Newsgroups: comp.os.linux
- Subject: Re: Pt 1/2: linux 0.98 c++ st
- Message-ID: <1jtsv0INNfvo@escargot.xx.rmit.OZ.AU>
- Date: 24 Jan 93 11:01:52 GMT
- References: <727676295.AA34613@remote.halcyon.com>
- Organization: RMIT Computer Centre
- Lines: 64
- NNTP-Posting-Host: minyos.xx.rmit.oz.au
-
- Paul.Caffrey@f15.n229.z1.fidonet.org (Paul Caffrey) writes:
-
- >Reply-To: pac30@DUTS.ccc.amdahl.com (Paul Caffrey)
-
- >PID: Fred 1.9n6
- >Hi,
-
- >I can't get the c++ stream io implementation of the 0.98 linux SLS
- >distribution
- >working.
-
- >The following program(cout.c):
-
- >#include <iostream.h>
- >main(){
- >cout << "Hello World!\n";
- >}
-
- >fails to compile (g++ cout.c) with the following message:
-
-
- >cout.o: Undefined symbol _cout referenced from text segment
- >cout.o: Undefined symbol operator<<(ostream &, const char *) referenced
- >from
- >text segment
-
- >Can anyone explain why this happens? All other c++ appear to be
- >working.
- >ps while I'm on is there a "dissambler" program for linux?
- >Paul
- >email pac30@amail.amdahl.com
-
- >ps the following is the file iostream.h
-
- [...245 lines of uselessness deleted]
-
- This is not really a question for the Linux newsgroup, but rather for
- the GCC newsgroup. Also it really *bugs* people when someone posts 500 tons
- of useless stuff with their article. If you are not sure what is necessary to
- solve your problem, then briefly describe your problem, and if more info is
- req'd, people will ask for it.
-
- As for your problem, it appears that the c++ library is not being
- linked in. When you build a simple C program with GCC, you usually type
- something like "gcc program.c -lc -lm" which means to link in the libraries
- "libc.a" (standard run time functions) and "libm.a" (math functions).
-
- In your case, you need to link in the c++ library, which I can't
- recall the name of (I'm not on my Linux box now). It might be "libg++.a" or
- "libc_p.a" (ie use -lg++ and/or -lc_p).
-
- I assume you are still using GCC v2.2.2d (type gcc -v) if you are
- running 0.98 (p6 ???). This is a note from H.J. with the release of the
- new libraries (for 2.3.3) which may also be pertinent.
-
- "Iostream is in libc.a To use it, you have to use -nojump or
- -static in your LDFLAGS"
-
- (Upshot of this is to use "-lc" --- other options only pertinent to 2.3.3, I
- think !!!)
-
-
-
- Paul.
-