public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* A query
@ 2002-01-15  1:33 Jaya_Kumari
  0 siblings, 0 replies; 2+ messages in thread
From: Jaya_Kumari @ 2002-01-15  1:33 UTC (permalink / raw)
  To: help-gcc

Dear Sir,
	We are developing a testsuite to test a protocol stack,in which some
are generated by the Telelogic tools for the test suite written by us which
are C files,while compiling with gcc compiler it works fine and while
compiling with g++ compiler it is giving errors.I wanted to know if there is
an option with g++ compiler where I can compile the C files,and the compiler
treats these files as C files and not C++ files.
I have another query whether in a makefile whether i can use gcc compiler to
compile C files and g++ compiler to compile C++ file and whether it is
possible to link the object files of C files and C++ files.
I need your help in solving these probelms.please help me out.

Anticipating a response from you.
Thanks and Regards,
Jaya Kumari

************************************************************************** 
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard
is appreciated.
**************************************************************************

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: A query
       [not found] <616BE6A276E3714788D2AC35C40CD18D2C59AC@whale.softwire.co.uk>
@ 2002-01-15  1:58 ` Rupert Wood
  0 siblings, 0 replies; 2+ messages in thread
From: Rupert Wood @ 2002-01-15  1:58 UTC (permalink / raw)
  To: 'Jaya_Kumari'; +Cc: gcc-help

Jaya_Kumari wrote:

> I wanted to know if there is an option with g++ compiler where I can
> compile the C files,and the compiler treats these files as C files
> and not C++ files.

Place '-x c' before any C filenames on the command line (see "g++
--help"). However, unless you're linking too, there is no difference
between 'gcc' and 'g++ -x c'.

> I have another query whether in a makefile whether i can use gcc
> compiler to compile C files and g++ compiler to compile C++ file

Yes; it may even happen automatically depending on the default rules of
your version of make (see its manpage). You may need to set environment
variables

    CC=gcc
    CXX=g++

or similar, e.g. Solaris make uses 'CCC' instead of 'CXX'. See the
documentation with your version of make.

If you're creating compilated build systems or need cross-platform
support then you may wish to investigate the GNU projects autoconf and
automake for makefile generation.

> and whether it is possible to link the object files of C files and
> C++ files.

Yes, provided you declare any C symbols 'extern "C"' in the C++ source
to turn of the C++ name-mangling scheme used for function overloads,
classes, etc. You should link with g++ rather than gcc.

Rup.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-01-15  9:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-15  1:33 A query Jaya_Kumari
     [not found] <616BE6A276E3714788D2AC35C40CD18D2C59AC@whale.softwire.co.uk>
2002-01-15  1:58 ` Rupert Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).