This is a list of frequently asked questions (FAQ) for g++ users; thanks to all those who sent suggestions for improvements. Thanks to Marcus Speh for doing the index. A hypertext version is available on the World Wide Web at `http://www.cygnus.com/misc/g++FAQ_toc.html'.
This document has just been reorganized a bit. There is some new information about upcoming g++ releases and egcs; more needs to be done but that will need to wait for next time. A diff would look misleadingly large, since I blew away and rebuilt the texinfo menus.
Please send updates and corrections to the FAQ to
jbuck@synopsys.com
. Please do not use me as a resource
to get your questions answered; that's what `gnu.g++.help' is for and I
don't have the time to support the net's use of g++.
Many FAQs, including this one, are available on the archive site
"rtfm.mit.edu"; see
`ftp://rtfm.mit.edu/pub/usenet/news.answers'.
This FAQ may be found in the subdirectory g++-FAQ.
This FAQ is intended to supplement, not replace, Marshall Cline's excellent FAQ for the C++ language and for the newsgroup `comp.lang.c++'. Especially if g++ is the first C++ compiler you've ever used, the question "How do I do <X> with g++?" is probably really "How do I do <X> in C++?". You can find this FAQ at `ftp://rtfm.mit.edu/pub/usenet/comp.lang.c++', or in HTML form at `http://www.cerfnet.com/~mpcline/On-Line-C++-FAQs/'.
g++ is the traditional nickname of GNU C++, a freely redistributable C++ compiler produced by the Free Software Foundation plus dozens of skilled volunteers. I say "traditional nickname" because the GNU compiler suite, gcc, bundles together compilers for C, Objective-C, and C++ in one package.
While the source code to gcc/g++ can be downloaded for free, it is not public domain, but is protected by the GNU Public License, or GPL (see section What are the rules for shipping code built with g++ and libg++?).
The current version of gcc/g++ is 2.7.2.3, released August 20, 1997. Although that looks very recent, the only change is a minor patch to resolve a problem with Linux and the GNU C library; users not interested in that functionality have no reason to upgrade.
The current version of libg++ is 2.7.2, released July 4, 1996. The last release of gcc/g++ with improvements to the C++ front end was 2.7.2, released Nov. 25, 1995, nearly two years ago.
I would strongly recommend that anyone using a g++ version earlier than 2.7.2 should upgrade if at all possible (see section What's new in version 2.7.x of gcc/g++).
For some non-Unix platforms, the latest port of gcc may be an earlier version (2.6.3, say). You'll need to use a version of libg++ that has the same first two digits as the compiler version, e.g. use libg++ 2.6.x (for the latest x you can find) with gcc version 2.6.3.
The latest "1.x" version of gcc is 1.42, and the latest "1.x" version of g++ is 1.42.0. While gcc 1.42 is quite usable for C programs, I recommend against using g++ 1.x except in special circumstances (and I can't think of any such circumstances).
First, you may already have it if you have gcc for your platform; g++ and gcc are combined now (as of gcc version 2.0).
You can get g++ from a friend who has a copy, by anonymous FTP or UUCP, or by ordering a tape or CD-ROM from the Free Software Foundation.
The Free Software Foundation is a nonprofit organization that distributes software and manuals to raise funds for more GNU development. Getting your copy from the FSF contributes directly to paying staff to develop GNU software. CD-ROMs cost $400 if an organization is buying, or $100 if an individual is buying. Tapes cost around $200 depending on media type. I recommend asking for version 2, not version 1, of g++.
For more information about ordering from the FSF, contact gnu@prep.ai.mit.edu, phone (617) 542-5942 or anonymous ftp file `ftp://prep.ai.mit.edu/pub/gnu/GNUinfo/ORDERS' (you can also use one of the sites listed below if you can't get into "prep").
Here is a list of anonymous FTP archive sites for GNU software. If no directory is given, look in `/pub/gnu'.
ASIA: ftp.cs.titech.ac.jp, tron.um.u-tokyo.ac.jp:/pub/GNU/prep cair-archive.kaist.ac.kr, ftp.nectec.or.th:/pub/mirrors/gnu AUSTRALIA: archie.au:/gnu (archie.oz or archie.oz.au for ACSnet) AFRICA: ftp.sun.ac.za MIDDLE-EAST: ftp.technion.ac.il:/pub/unsupported/gnu EUROPE: irisa.irisa.fr, ftp.univ-lyon1.fr, ftp.mcc.ac.uk, unix.hensa.ac.uk:/mirrors/uunet/systems/gnu, src.doc.ic.ac.uk:/gnu, ftp.ieunet.ie, ftp.eunet.ch, nic.switch.ch:/mirror/gnu, ftp.informatik.rwth-aachen.de, ftp.informatik.tu-muenchen.de, ftp.win.tue.nl, ftp.nl.net, ftp.etsimo.uniovi.es, ftp.funet.fi, ftp.denet.dk, ftp.stacken.kth.se, isy.liu.se, ftp.luth.se:/pub/unix/gnu, ftp.sunet.se, archive.eu.net SOUTH AMERICA: ftp.inf.utfsm.cl, ftp.unicamp.br WESTERN CANADA: ftp.cs.ubc.ca:/mirror2/gnu USA: wuarchive.wustl.edu:/systems/gnu, labrea.stanford.edu, ftp.digex.net, ftp.kpc.com:/pub/mirror/gnu, f.ms.uky.edu:/pub3/gnu, jaguar.utah.edu:/gnustuff, ftp.hawaii.edu:/mirrors/gnu, uiarchive.cso.uiuc.edu, ftp.cs.columbia.edu:/archives/gnu/prep, gatekeeper.dec.com:/pub/GNU, ftp.uu.net:/systems/gnu
The "official site" is prep.ai.mit.edu, but your transfer will probably go faster if you use one of the above machines.
Most GNU utilities are compressed with "gzip", the GNU compression utility. All GNU archive sites should have a copy of this program, which you will need to uncompress the distributions.
Don't forget to retrieve libg++ as well!
If you use the HP Precision Architecture (HP-9000/7xx and HP-9000/8xx) and you want to use debugging, you'll need to use the GNU assembler, GAS (version 2.3 or later). If you build from source, you must tell the configure program that you are using GAS or you won't get debugging support. A non-standard debug format is used, since until recently HP considered their debug format a trade secret. Thanks to the work of lots of good folks both inside and outside HP, the company has seen the error of its ways and has now released the required information. The team at the University of Utah that did the gcc port now has code that understands the native HP format.
There are binaries for GNU tools in `ftp://jaguar.cs.utah.edu/dist/', but these are older versions.
Jeff Law has left the University of Utah, so the Utah prebuilt binaries may be discontinued.
"Sun took the C compiler out of Solaris 2.x. Am I stuck?"
You'll need to get prebuilt binaries from someone.
It used to be that you could get GCC binaries from prep.ai.mit.edu; these are no longer there.
The WWW site `http://smc.vnet.net/solaris_2.5.html' contains various GNU and freeware programs for Solaris2.5 running on the sparc. These are packaged to enable easy installation using the Solaris "pkgadd" utility. These include GNU emacs, gcc, gdb, perl, and others. These versions are more recent than the binaries at "prep" (gcc 2.7.2 and libg++ 2.7.1 are there).
As of gcc-2.7.x, there is Windows NT support in gcc. Some special utilities are required. See the INSTALL file from the distribution. If you're interested in GNU tools on Windows NT, see `http://www.cygnus.com/misc/gnu-win32/' on the WWW, or the anonymous FTP directory `ftp://ftp.cygnus.com/pub/gnu-win32/'.
The standard gcc/g++ distribution includes VMS support for the Vax. Since the FSF people don't use VMS, it's likely to be somewhat less solid than the Unix version. Precompiled copies of g++ and libg++ in VMS-installable form for the Vax are available by FTP from `ftp://mango.rsmas.miami.edu/pub/VMS-gcc/'.
Klaus Kaempf (kkaempf@progis.de) has done a port to OpenVMS for the Alpha; this is not yet a part of the official gcc/g++. The port includes g++ and all libraries from the libg++ distribution. See `http://www.progis.de' for more details.
There are two different versions of gcc/g++ for MS-DOS: EMX and DJGPP. EMX also works for OS/2 and is described later. DJGPP is DJ Delorie's port. It can be found on many FTP archive sites; try `ftp://ftp.coast.net/SimTel/vendors/djgpp/' or, for a complete list, see `http://www.delorie.com/djgpp/getting.html'.
The latest version of DJGPP is 2.00. See `http://www.delorie.com/djgpp/v2/' for information on this version.
FSF sells floppies with DJGPP on them; see above for ordering software from the FSF.
DJGPP has its own newsgroup: `comp.os.msdos.djgpp'.
Development and porting efforts for GNU tools, including gcc/g++, for the Amiga are maintained by an initiative named ADE (Amiga Developers Environment. More information about ADE is available at `http://www.ninemoons.com/'.
For more information on Amiga ports of gcc/g++, retrieve the file `ftp://prep.ai.mit.edu/pub/gnu/MicrosPorts/Amiga'.
A port of gcc to the Atari ST can be found at
`ftp://atari.archive.umich.edu/atari/Gnustuff/Tos'
along with many
other GNU programs. This version is usually the same as the latest FSF
release. See the "Software FAQ" for the Usenet group
`comp.sys.atari.st' for more information.
EMX is a port of gcc to OS/2; it can also be used on MS-DOS. In addition to the compiler port, the EMX port's C library attempts to provide a Unix-like environment. For more information ask around on `comp.os.os2.programmer.porting'. Version 0.9c, based on gcc-2.7.2.1, was released in November 1996. It is available by FTP and the WWW from, among other places
`http://www.os2ss.com/unix/emx09c/' `ftp://ftp.cdrom.com/pub/os2/emx09c/' (US) `ftp://ftp.leo.org/pub/comp/os/os2/leo/devtools/emx+gcc/' (Germany)
Eberhard Mattes did the EMX port. His address is mattes@azu.informatik.uni-stuttgart.de. Read the FAQ file included with the distribution before harassing the author.
I'm looking for more information on gcc/g++ support on the Apple Macintosh. Until recently, this FAQ did not provide such information, but FSF is no longer boycotting Apple as the League for Programming Freedom boycott has been dropped.
Versions 1.37.1 and 2.3.3 of gcc were ported by Stan Shebs and are available
at
`ftp://ftp.cygnus.com/pub/mac'
They are both interfaced to MPW. Stan is working on a version using the current (post-2.7) sources, contact him directly (shebs@cygnus.com) for more information.
"I keep hearing people talking about g++ 2.7.2 (or some other number starting with 2), but the latest version I can find is g++ 1.42. Where is it?"
As of gcc 2.0, C, C++, and Objective-C as well are all combined into a single distribution called gcc. If you get gcc you already have g++. The standard installation procedure for any gcc version 2 compiler will install the C++ compiler as well.
One could argue that we shouldn't even refer to "g++-2.x.y" but it's a convention. It means "the C++ compiler included with gcc-2.x.y."
Go to the first, previous, next, last section, table of contents.