Go to the first, previous, next, last section, table of contents.


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'.

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++. If you ignore this request your message to me may be deleted without a reply. Sorry.

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/'.

The basics: what is g++?

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++?).

What is the latest version of gcc, g++, and libg++?

The newest release from the egcs project (on the Web: `http://www.cygnus.com/egcs/') is egcs-1.0.3, released May 15, 1998.

The current version of gcc/g++ is 2.8.1, released March 4, 1998. This release fixes some bugs in the 2.8.x release from January. It is a huge improvement over the 2.7.x releases.

libg++ has now been deprecated (that is, it is no longer really supported), so gcc2.8.1 users need to grab libstdc++-2.8.1 from their favorite GNU site (egcs users don't need to get this separately as it is bundled with egcs). However, there is an 'add-on' libg++ 2.8.1 mini-release. If you want to use it, you need to combine it with libstdc++ 2.8.1.

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++). Folks who need modern C++ features should upgrade to 2.8.1 or egcs.

For some non-Unix platforms, the latest port of gcc may be an earlier version (2.7.2, 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.7.x (for the latest x you can find) with gcc version 2.7.2.1.

From version 2.8.0 on, you don't need libg++, you only need libstdc++ (again, the latest version with the same two leading digits as the version of g++ you use).

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, g++ 1.x is only of historical interest (since the C++ language has changed so much).

How do I get a copy of g++ for Unix?

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 libstdc++ as well!

How do I get egcs?

See See section What is egcs? to find out what egcs is.

You can obtain egcs either by FTP or with a Web browser. To do the latter, start from `http://egcs.cygnus.com/'. The master FTP site is `ftp://ftp.cygnus.com/pub/egcs/releases', however you'll probably get a faster download if you use a mirror site. Mirror sites also have egcs snapshots unless otherwise noted.

Getting gcc/g++ for the HP Precision Architecture

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.

Getting gcc/g++ binaries for Solaris 2.x

"Sun took the C compiler out of Solaris 2.x. Am I stuck?"

You can obtain and install prebuilt binaries of gcc.

The WWW site `http://smc.vnet.net/' contains various GNU and freeware programs for Solaris 2.5 or 2.6, for either the Sparc or Intel platforms. These are packaged to enable easy installation using the Solaris "pkgadd" utility. These include GNU emacs, gcc, gdb, perl, and others.

You can find also find prebuilt binaries of many GNU tools, including the compiler, at `http://sunsite.unc.edu/pub/solaris/'.

How do I get a copy of g++ for (some other platform)?

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 harrassing 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.

But I can only find g++-1.42!

"I keep hearing people talking about g++ 2.8.1 (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.