home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / amiga / programm / 15924 < prev    next >
Encoding:
Text File  |  1992-11-17  |  2.4 KB  |  49 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!wupost!gumby!yale!yale.edu!ira.uka.de!chx400!bernina!wild
  3. From: wild@nessie.cs.id.ethz.ch (Markus Wild)
  4. Subject: Re: found g++ in gcc, but can`t seem to co
  5. Message-ID: <1992Nov16.214120.4146@bernina.ethz.ch>
  6. Sender: news@bernina.ethz.ch (USENET News System)
  7. Organization: Swiss Federal Institute of Technology (ETH), Zurich, CH
  8. References: <1992Nov14.082116.254@bernina.ethz.ch> <1992Nov16.070023.20559@eua.ericsson.se>
  9. Date: Mon, 16 Nov 1992 21:41:20 GMT
  10. Lines: 37
  11.  
  12. In article <1992Nov16.070023.20559@eua.ericsson.se> etxpihl@eua.ericsson.se writes:
  13. >In article 254@bernina.ethz.ch, wild@nessie.cs.id.ethz.ch (Markus Wild) writes:
  14. >> If using gcc, you have to explicitly specify to link with -lg++. When using
  15. >> g++, the driver takes care of specifying -lg++, so you don't have to specify
  16. >> it explicitly.
  17. >
  18. >I had the same problem. I've tried to specify -lg++, but it didn't work. I turned
  19. >on verbose mode (-v) and saw that -lg++ now suddenly was -lg ?!. So, I renamed
  20. >libg++.a to libg.a and everything work just fine.  Don't ask me how g++ could end
  21. >up as just g...
  22.  
  23. Don't forget the space after -lg++, or DOS interprets the +'s as line 
  24. continuation characters, and the application will never see them.
  25.  
  26. >One more question when I'm on the air:
  27. >
  28. > How can a simple C++-program that just do a cout << "Hellp world" end up as a 
  29. >54kb binary file?
  30.  
  31. This is due to the way C++ classes are implemented. Normally, each class is
  32. implemented with one header file and one implementation file. The latter
  33. can get quite large. So, for example, all the code needed to implement 
  34. the "<<" on cout is one or more rather huge object files, containing tons
  35. of functions you don't really want, but which you can't get rid of, because
  36. the linker can't extract functions selectively from an object file. In order
  37. to get smaller executables, you'd have to put each function in its own
  38. source file, but then you'd get into troubles with classes... it's quite
  39. weird in this region...
  40.  
  41. -Markus
  42.  
  43. PS: at least, this is not a problem specific to g++, other C++ should have the
  44. -- 
  45. Markus M. Wild    -  wild@nessie.cs.id.ethz.ch  |  wild@amiga.physik.unizh.ch 
  46. Vital papers will demonstrate their vitality by spontaneously moving
  47. from where you left them to where you can't find them.
  48.