home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- 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
- From: wild@nessie.cs.id.ethz.ch (Markus Wild)
- Subject: Re: found g++ in gcc, but can`t seem to co
- Message-ID: <1992Nov16.214120.4146@bernina.ethz.ch>
- Sender: news@bernina.ethz.ch (USENET News System)
- Organization: Swiss Federal Institute of Technology (ETH), Zurich, CH
- References: <1992Nov14.082116.254@bernina.ethz.ch> <1992Nov16.070023.20559@eua.ericsson.se>
- Date: Mon, 16 Nov 1992 21:41:20 GMT
- Lines: 37
-
- In article <1992Nov16.070023.20559@eua.ericsson.se> etxpihl@eua.ericsson.se writes:
- >In article 254@bernina.ethz.ch, wild@nessie.cs.id.ethz.ch (Markus Wild) writes:
- >> If using gcc, you have to explicitly specify to link with -lg++. When using
- >> g++, the driver takes care of specifying -lg++, so you don't have to specify
- >> it explicitly.
- >
- >I had the same problem. I've tried to specify -lg++, but it didn't work. I turned
- >on verbose mode (-v) and saw that -lg++ now suddenly was -lg ?!. So, I renamed
- >libg++.a to libg.a and everything work just fine. Don't ask me how g++ could end
- >up as just g...
-
- Don't forget the space after -lg++, or DOS interprets the +'s as line
- continuation characters, and the application will never see them.
-
- >One more question when I'm on the air:
- >
- > How can a simple C++-program that just do a cout << "Hellp world" end up as a
- >54kb binary file?
- >
-
- This is due to the way C++ classes are implemented. Normally, each class is
- implemented with one header file and one implementation file. The latter
- can get quite large. So, for example, all the code needed to implement
- the "<<" on cout is one or more rather huge object files, containing tons
- of functions you don't really want, but which you can't get rid of, because
- the linker can't extract functions selectively from an object file. In order
- to get smaller executables, you'd have to put each function in its own
- source file, but then you'd get into troubles with classes... it's quite
- weird in this region...
-
- -Markus
-
- PS: at least, this is not a problem specific to g++, other C++ should have the
- --
- Markus M. Wild - wild@nessie.cs.id.ethz.ch | wild@amiga.physik.unizh.ch
- Vital papers will demonstrate their vitality by spontaneously moving
- from where you left them to where you can't find them.
-