Date: Tue, 24 Jun 1997 08:34:21 -0400 (EDT) From: "Art S. Kagel" To: Liam Cc: John Syers , djgpp AT delorie DOT com Subject: Re: trouble compiling c++ In-Reply-To: <199706241043.KAA12868@mx2.rmplc.co.uk> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Mon, 23 Jun 1997, Liam wrote: > Art S. Kagel wrote: > > You do not show the comand line that you used. I suspect that you named > > your 'hello' program hello.c even though it contains C++ code and the 'C' > > > parser does not know what to do with it. You probably should have called > > the file hello.cc. > Can't it tell the difference between C and C++ code > with out relying on the extension of a file? No. The syntax parser phase for C and C++ are two completely different executables. Gcc needs to know which to start up. Since the syntax is about 80% the same gcc would have to scan a large percentage of your program to decide. In addition, since you can use pure "C" syntax in C++ modules that do not need OO features it might make the wrong choice and compile a particular module for "C" and not be able to successfully link later as C++ requires function name mangling and "C" compilers do not produce mangled function names. Art S. Kagel, kagel AT bloomberg DOT com