home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / linux / 25295 < prev    next >
Encoding:
Text File  |  1993-01-24  |  2.3 KB  |  76 lines

  1. Path: sparky!uunet!munnari.oz.au!goanna!escargot!minyos.xx.rmit.OZ.AU!rcopg
  2. From: rcopg@minyos.xx.rmit.OZ.AU (Paul Gortmaker)
  3. Newsgroups: comp.os.linux
  4. Subject: Re: Pt 1/2: linux 0.98 c++ st
  5. Message-ID: <1jtsv0INNfvo@escargot.xx.rmit.OZ.AU>
  6. Date: 24 Jan 93 11:01:52 GMT
  7. References: <727676295.AA34613@remote.halcyon.com>
  8. Organization: RMIT Computer Centre
  9. Lines: 64
  10. NNTP-Posting-Host: minyos.xx.rmit.oz.au
  11.  
  12. Paul.Caffrey@f15.n229.z1.fidonet.org (Paul Caffrey) writes:
  13.  
  14. >Reply-To: pac30@DUTS.ccc.amdahl.com (Paul Caffrey)
  15.  
  16. >PID: Fred 1.9n6
  17. >Hi,
  18.  
  19. >I can't get the c++ stream io implementation of the 0.98 linux SLS
  20. >distribution
  21. >working.
  22.  
  23. >The following program(cout.c):
  24.  
  25. >#include <iostream.h>
  26. >main(){
  27. >cout << "Hello World!\n";
  28. >}
  29.  
  30. >fails to compile (g++ cout.c) with the following message:
  31.  
  32.  
  33. >cout.o: Undefined symbol _cout referenced from text segment
  34. >cout.o: Undefined symbol operator<<(ostream &, const char *) referenced
  35. >from
  36. >text segment
  37.  
  38. >Can anyone explain why this happens? All other c++ appear to be
  39. >working.
  40. >ps while I'm on is there a "dissambler" program for linux?
  41. >Paul
  42. >email pac30@amail.amdahl.com
  43.  
  44. >ps the following is the file iostream.h
  45.  
  46. [...245 lines of uselessness deleted]
  47.  
  48.     This is not really a question for the Linux newsgroup, but rather for 
  49. the GCC newsgroup. Also it really *bugs* people when someone posts 500 tons
  50. of useless stuff with their article. If you are not sure what is necessary to 
  51. solve your problem, then briefly describe your problem, and if more info is
  52. req'd, people will ask for it.
  53.  
  54.     As for your problem, it appears that the c++ library is not being 
  55. linked in. When you build a simple C program with GCC, you usually type
  56. something like "gcc program.c -lc -lm" which means to link in the libraries
  57. "libc.a" (standard run time functions) and "libm.a" (math functions).
  58.  
  59.     In your case, you need to link in the c++ library, which I can't
  60. recall the name of (I'm not on my Linux box now). It might be "libg++.a" or
  61. "libc_p.a" (ie use -lg++ and/or -lc_p).
  62.  
  63.     I assume you are still using GCC v2.2.2d (type gcc -v) if you are 
  64. running 0.98 (p6 ???). This is a note from H.J. with the release of the
  65. new libraries (for 2.3.3) which may also be pertinent.
  66.  
  67.     "Iostream is in libc.a To use it, you have to use -nojump or
  68.     -static in your LDFLAGS"
  69.  
  70. (Upshot of this is to use "-lc" --- other options only pertinent to 2.3.3, I
  71. think !!!)
  72.  
  73.  
  74.  
  75.                                 Paul.
  76.