This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Compile commands - Chapter 25 example, for example
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: "Matthew D. Gutchess" <mdgutchess1 at juno dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Sat, 17 Dec 2011 23:04:42 +0000
- Subject: Re: Compile commands - Chapter 25 example, for example
- References: <20111217.172905.28470.0@webmail08.dca.untd.com>
On 17 December 2011 22:29, Matthew D. Gutchess wrote:
> Hi,
> ? ?I just started using (2011 Dec 16) the gcc compiler which was included with Ubuntu 11.04. ?Can you include compile commands in your manual? ?Compiling the example in Chapter 25 on output buffers, which I called "outbuf1_Josuttis_text.cpp", produced lots of error messages, included below. ?Because this program is made for gcc and listed on the gcc website, I figure that I need a more complex "gcc" command with specific references to the locations of libraries.
You should use g++ to compile C++ programs instead of gcc, as
explained in the manual under "Compiling C++ Programs"
http://gcc.gnu.org/onlinedocs/gcc/Invoking-G_002b_002b.html
"However, the use of gcc does not add the C++ library. g++ is a
program that calls GCC and treats `.c', `.h' and `.i' files as C++
source files instead of C source files unless -x is used, and
automatically specifies linking against the C++ library."