g++faq.texi
来自「GCC编译器源代码」· TEXI 代码 · 共 1,691 行 · 第 1/5 页
TEXI
1,691 行
\input texinfo.tex @c -*-texinfo-*-@c %**start of header@setfilename g++FAQ.info@settitle Frequently asked questions about the GNU C++ compiler@setchapternewpage off@c version: @(#)g++FAQ.texi 1.56 09/15/97@c %**end of header@iftex@finalout@end iftex@titlepage@title G++ FAQ@subtitle Frequently asked questions about the GNU C++ compiler@subtitle September 14, 1997@sp 1@author Joe Buck@page@end titlepage@ifinfo@node Top, basics, (dir), (dir)@top@unnumbered FAQ for g++ and libg++, by Joe Buck (jbuck@@synopsys.com)@end ifinfo@cindex FAQ for g++, latest version@cindex Archive site for FAQ lists@cindex rtfm.mit.edu@cindex Joe Buck <jbuck@@synopsys.com>@cindex FAQ for C++This is a list of frequently asked questions (FAQ) for g++ users; thanks toall those who sent suggestions for improvements. Thanks to Marcus Spehfor doing the index. A hypertext version is available on the World WideWeb at @file{http://www.cygnus.com/misc/g++FAQ_toc.html}.This document has just been reorganized a bit. There is some newinformation about upcoming g++ releases and egcs; more needs to be donebut that will need to wait for next time. A diff would look misleadinglylarge, since I blew away and rebuilt the texinfo menus.Please send updates and corrections to the FAQ to@code{jbuck@@synopsys.com}. Please do @emph{not} use me as a resourceto get your questions answered; that's what @file{gnu.g++.help} is for and Idon'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 @*@file{ftp://rtfm.mit.edu/pub/usenet/news.answers}.This FAQ may be found in the subdirectory g++-FAQ.@cindex Marshall Cline @cindex comp.lang.c++@cindex C++ FAQThis FAQ is intended to supplement, not replace, Marshall Cline'sexcellent FAQ for the C++ language and for the newsgroup@file{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@file{ftp://rtfm.mit.edu/pub/usenet/comp.lang.c++},or in HTML form at @file{http://www.cerfnet.com/~mpcline/On-Line-C++-FAQs/}.@menu* basics:: What is g++? How do I get it?* installation:: How to install, installation problems* evolution:: The Evolution of g++* User Problems:: Commonly reported problems and bugs* legalities:: Lawyer stuff, GPL, LGPL, etc.* index:: Index of terms --- The Detailed Node Listing ---The basics: what is g++?* latest versions:: * g++ for Unix:: * g++ for HP:: * g++ for Solaris 2.x:: * g++ for other platforms:: * 1.x vs 2.x versions:: Installation Issues and Problems* gcc-2 + g++-1:: * what else do I need?:: * use GNU linker?:: * Use GNU assembler?:: * shared libraries:: * repository:: * repo bugs:: * Use GNU C library?:: * Global constructor problems:: * Strange assembler errors:: * Other problems building libg++:: * More size_t problems:: * Rebuild libg++?:: * co-existing versions:: * Installing on Linux:: * Linux Slackware 3.0:: The Evolution of g++* version 2.7.x:: * libstdc++:: * new work:: * egcs:: * When?:: User Problems* missing virtual table:: * for scope:: * const constructor:: * unused parameter warnings:: * jump crosses initialization:: * Demangler:: * static data members:: * internal compiler error:: * bug reports:: * porting to g++:: * name mangling:: * problems linking with other libraries:: * documentation:: * templates:: * undefined templates:: * redundant templates:: * Standard Template Library:: * STL and string:: * exceptions:: * namespaces:: * agreement with standards:: * compiling standard libraries:: * debugging on SVR4 systems:: * debugging problems on Solaris:: * X11 conflicts with libg++:: * assignment to streams:: @end menu@node basics, installation, Top, Top@chapter The basics: what is g++?@cindex Free Software Foundation@cindex GNU Public License@cindex GPLg++ is the traditional nickname of GNU C++, a freely redistributableC++ compiler produced by the Free Software Foundation plus dozens ofskilled volunteers. I say ``traditional nickname'' because the GNUcompiler 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 (@pxref{legalities}).@menu* latest versions:: * g++ for Unix:: * g++ for HP:: * g++ for Solaris 2.x:: * g++ for other platforms:: * 1.x vs 2.x versions:: @end menu@node latest versions, g++ for Unix, basics, basics@section What is the latest version of gcc, g++, and libg++?@cindex gcc/g++, version dateThe 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 toresolve a problem with Linux and the GNU C library; users not interestedin 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 was2.7.2, released Nov. 25, 1995, nearly two years ago.I would strongly recommend that anyone using a g++ version earlierthan 2.7.2 should upgrade if at all possible (@pxref{version 2.7.x}).For some non-Unix platforms, the latest port of gcc may be an earlierversion (2.6.3, say). You'll need to use a version of libg++ thathas 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 ofg++ 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).@node g++ for Unix, g++ for HP, latest versions, basics@section 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).@cindex GNU gcc, version@cindex GNU g++ and gccYou can get g++ from a friend who has a copy, by anonymous FTP orUUCP, or by ordering a tape or CD-ROM from the Free SoftwareFoundation.@cindex g++, ordering@cindex g++, getting a copyThe Free Software Foundation is a nonprofit organization thatdistributes software and manuals to raise funds for more GNUdevelopment. Getting your copy from the FSF contributes directly topaying staff to develop GNU software. CD-ROMs cost $400 if anorganization is buying, or $100 if an individual is buying. Tapescost around $200 depending on media type. I recommend asking forversion 2, not version 1, of g++.@cindex FSF [Free Software Foundation]@cindex GNU [GNU's not unix]For more information about ordering from the FSF, contactgnu@@prep.ai.mit.edu, phone (617) 542-5942 or anonymous ftp file@file{ftp://prep.ai.mit.edu/pub/gnu/GNUinfo/ORDERS} (you canalso use one of the sites listed below if you can't get into ``prep'').@cindex FSF, contact <gnu@@prep.ai.mit.edu>Here is a list of anonymous FTP archive sites for GNU software.If no directory is given, look in @file{/pub/gnu}.@cindex GNUware, anonymous FTP sites@exampleASIA: ftp.cs.titech.ac.jp, tron.um.u-tokyo.ac.jp:/pub/GNU/prepcair-archive.kaist.ac.kr, ftp.nectec.or.th:/pub/mirrors/gnuAUSTRALIA: archie.au:/gnu (archie.oz or archie.oz.au for ACSnet)AFRICA: ftp.sun.ac.zaMIDDLE-EAST: ftp.technion.ac.il:/pub/unsupported/gnuEUROPE: 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.netSOUTH AMERICA: ftp.inf.utfsm.cl, ftp.unicamp.brWESTERN CANADA: ftp.cs.ubc.ca:/mirror2/gnuUSA: 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@end exampleThe ``official site'' is prep.ai.mit.edu, but your transfer will probablygo faster if you use one of the above machines.@cindex gzipMost GNU utilities are compressed with ``gzip'', the GNU compressionutility. All GNU archive sites should have a copy of this program,which you will need to uncompress the distributions.@cindex libg++Don't forget to retrieve libg++ as well!@node g++ for HP, g++ for Solaris 2.x, g++ for Unix, basics@section Getting gcc/g++ for the HP Precision Architecture@cindex HP Precision Architecture@cindex Hewlett-Packard@cindex GNU GAS @cindex GNU gdbIf 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 theconfigure program that you are using GAS or you won't get debuggingsupport. A non-standard debug format is used, since until recently HPconsidered their debug format a trade secret. Thanks to the work oflots of good folks both inside and outside HP, the company has seen theerror of its ways and has now released the required information. Theteam at the University of Utah that did the gcc port now has code thatunderstands the native HP format.There are binaries for GNU tools in@file{ftp://jaguar.cs.utah.edu/dist/},but these are older versions.Jeff Law has left the University of Utah, so the Utah prebuiltbinaries may be discontinued.@node g++ for Solaris 2.x, g++ for other platforms, g++ for HP, basics@section Getting gcc/g++ binaries for Solaris 2.x``Sun took the C compiler out of Solaris 2.x. Am I stuck?''@cindex Solaris@cindex gcc/g++ binaries for SolarisYou'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.@cindex Solaris pkgadd utilityThe WWW site @file{http://smc.vnet.net/solaris_2.5.html}contains variousGNU and freeware programs for Solaris2.5 running on the sparc. These arepackaged to enable easy installation using the Solaris ``pkgadd'' utility.These include GNU emacs, gcc, gdb, perl, and others. These versionsare more recent than the binaries at ``prep'' (gcc 2.7.2 and libg++2.7.1 are there).@node g++ for other platforms, 1.x vs 2.x versions, g++ for Solaris 2.x, basics@section How do I get a copy of g++ for (some other platform)?@cindex Windows NT supportAs of gcc-2.7.x, there is Windows NT support in gcc. Some specialutilities are required. See the INSTALL file from the distribution.If you're interested in GNU tools on Windows NT, see@file{http://www.cygnus.com/misc/gnu-win32/} on the WWW, or theanonymous FTP directory@file{ftp://ftp.cygnus.com/pub/gnu-win32/}.@cindex VMS support@cindex VAX@cindex VMS, g++/libg++ precompiledThe standard gcc/g++ distribution includes VMS support for the Vax.Since the FSF people don't use VMS, it's likely to be somewhat lesssolid than the Unix version. Precompiled copies of g++ and libg++ inVMS-installable form for the Vax are available by FTP from@file{ftp://mango.rsmas.miami.edu/pub/VMS-gcc/}.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?