Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do the input and output "languages" for the -x flag in GCC mean?

I am trying to compile a piece of code that was previously compiled with gfortran in ifort instead. The old compile line has a -xf95-cpp-input option in it that doesn't make sense to me.

Looking in the GCC docs, it seems like the -x option tells the compiler to ignore the file extension of the source code file, and parse it explicitly with the language you tell it to. So for example, I could run gfortran -xf77 myfunkycode.lulwut and it will parse my .lulwut file as an f77 file.

This makes sense, but then what does f95-cpp-input or c++-cpp-output mean? What do 'input' and 'output' even mean in this context? I'm guessing "input" is the source code? "Output" is the object file? According to the docs, -x is just for choosing the "language of the input file," why is 'output' in the language list at all?

like image 707
Frank Avatar asked Nov 30 '25 06:11

Frank


1 Answers

f95-cpp-input

Compile the source file as f95 file with cpp preprocessor.

c++-cpp-output

Compile the source file as C++ file without cpp preprocessor.

What do 'input' and 'output' even mean in this context?

Just a convention I guess.

like image 165
KamilCuk Avatar answered Dec 02 '25 00:12

KamilCuk