This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: -x option for gcc
- From: Brian Dessent <brian at dessent dot net>
- To: Anitha Boyapati <anithab at sankhya dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 20 Oct 2006 00:30:18 -0700
- Subject: Re: -x option for gcc
- References: <Pine.LNX.4.44.0610201156531.22157-100000@linux42.sankhya.com>
- Reply-to: gcc-help at gcc dot gnu dot org
Anitha Boyapati wrote:
> [I am literally a novice.Kindly bear with me]
>
> I wrote a c++ program (test.cc) which runs well with g++.
> Now I tried to compile with with gcc now :
>
> gcc -x c++ test.cc
>
> Now the compiler shouts at me saying there are some undefined references.
> (The list is truly long compared to the source program).
The real question is why you would want to do this. Supplying "-x c++"
does not have the same effect as invoking g++, which knows all the
necessary libraries and options to pass on to the subprocesses. All -x
does is set the type of language by which the file will be interpreted,
but there is more to it. You will run into all kinds of problems by not
invoking the g++ driver for C++ code.
Brian