top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

what is the use of -x in gcc ??

0 votes
what is the use of -x in gcc ??
posted Jul 26, 2014 by Ganesh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

You can specify the input language explicitly with the '-x' option. This option applies to all following input files until the next '-x' option. Possible values for language are:

c c-header cpp-output c++ c++-cpp-output objective-c objc-cpp-output
assembler assembler-with-cpp f77 f77-cpp-input ratfor java

Source: GCC manual

answer Jul 27, 2014 by Salil Agrawal
Similar Questions
+1 vote

I wanted to ask what is the GCC C++ equivalent implementation of Windows _ MyFirst and _MyLast vector pointers?

These give direct access to the vectors first and last element, but they are not present in the GCC implementation of the vector class.

+1 vote

I don't really understand this option. I enabled it but it warns for essentially all of my classes which have any virtual methods. For
example if I have Foo.h:

 class Foo {
 virtual bool bar();

then Foo.cpp which implements Foo. And then in another header somewhere else I inherit from Foo and implement bar() differently (as a virtual function). However when GCC compiles Foo.cpp it can't see the other header, so I guess it assumes no one inherits from Foo and suggests it should be marked final:

Declaring type 'class Foo' final would enable devirtualization of N calls

I mean sure, it would, but that would defeat the entire point (as I understand it).

I don't really understand how/where this option is meant to be used.
Ditto for -Wsuggest-final-methods.

0 votes

I'm studying about C compiler for increasing software quality. So I want to get all of compile error message list of gcc about C language. I was trying to find it. But I can't find it anywhere. How can I find it?

Please help?

+1 vote

I am using the -fdump-translation-unit option of GCC to parse C enum/structure/union/arrays. Consider the below code

enum eDAY
 monday = 0,

enum eDAY day = monday;

I can get all the members of the enumerator parsing the dump of GCC. But if the below declaration was not present

enum eDAY day = monday;

GCC's dump doesn't have any information about the members of the enumerator. The same problem exists with structures/unions etc. How can I solve this problem. Is there some kind of optimization flag which I need to turn off so that GCC parses all the objects even if it is not used ?

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.