This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: compiler problems pt2
- From: me22 <me22 dot ca at gmail dot com>
- To: reswatson at yahoo dot com
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 2 Jan 2009 14:26:15 -0500
- Subject: Re: compiler problems pt2
- References: <605208.47460.qm@web54002.mail.re2.yahoo.com>
On Fri, Jan 2, 2009 at 12:01, robert watson <reswatson@yahoo.com> wrote:
>
> Thanks for the replies. Compiling my code using:
>
> cd Desktop
> g++ /home/robert/Desktop/test.c # uses c++ compiler
>
> Instead of:
>
> cd Desktop
> gcc /home/robert/Desktop/test.c # uses c++ compiler
>
> Produced no errors, and an output file called 'a.out', so I guess that means g++ keeps tabs on the libraries better.
>
g++ links to the C++ library; gcc does not.
I think you problem might be that you have C++ code in a .c file.
(IIRC, gcc/g++ chooses the frontend based on the file extension.) Try
.cpp .cc .C or .cxx instead.