les extensions pour gcc
Une fausse rumeur sur gcc: "Les extensions n'ont pas d'importances". Très présente sur les forums linux, cette rumeur est aussi fausse que nuisible.
D' ou vient cette rumeur? Du fait que linux n'identifie pas les types de fichiers grâce à l'extension mais une entête MIME (me demandez pas trop de détails... ) fait croire à beaucoup que les extensions sont inutiles.
C'est très faux. L'entête MIME générée correspond à un fichier texte, et pas autre chose. GCC transforme un fichier texte en un code. Malheureusement GCC connaît plusieurs langages et il faut l'aider à reconnaître de quel langage il s'agit. Heureusement l'extension apporte au compilateur l'information qui va lui manquer: quel est le langage?
EXTRAITS DE MAN GCC
tout le monde me crois qu'il y a 2 langages reconnus... Passons à la ligne 416 et suivantes:
Options Controlling the Kind of Output
Compilation can involve up to four stages: preprocessing, compilation proper,
assembly and linking, always in that order. GCC is capable of preprocessing
and compiling several files either into several assembler input files, or into
one assembler input file; then each assembler input file produces an object
file, and linking combines all the object files (those newly compiled, and
those specified as input) into an executable file.
For any given input file, the file name suffix determines what kind of compi‐
lation is done:
file.c
C source code which must be preprocessed.
file.i
C source code which should not be preprocessed.
file.ii
C++ source code which should not be preprocessed.
file.m
Objective-C source code. Note that you must link with the libobjc library
to make an Objective-C program work.
file.mi
Objective-C source code which should not be preprocessed.
file.mm
file.M
Objective-C++ source code. Note that you must link with the libobjc
library to make an Objective-C++ program work. Note that .M refers to a
literal capital M.
file.mii
Objective-C++ source code which should not be preprocessed.
file.h
C, C++, Objective-C or Objective-C++ header file to be turned into a pre‐
compiled header.
file.cc
file.cp
file.cxx
file.cpp
file.CPP
file.c++
file.C
C++ source code which must be preprocessed. Note that in .cxx, the last
two letters must both be literally x. Likewise, .C refers to a literal
capital C.
file.hh
file.H
C++ header file to be turned into a precompiled header.
file.f
file.for
file.FOR
Fortran source code which should not be preprocessed.
file.F
file.fpp
file.FPP
Fortran source code which must be preprocessed (with the traditional pre‐
processor).
file.r
Fortran source code which must be preprocessed with a RATFOR preprocessor
(not included with GCC).
file.f90
file.f95
Fortran 90/95 source code which should not be preprocessed.
file.ads
Ada source code file which contains a library unit declaration (a declara‐
tion of a package, subprogram, or generic, or a generic instantiation), or
a library unit renaming declaration (a package, generic, or subprogram
renaming declaration). Such files are also called specs.
file.adb
Ada source code file containing a library unit body (a subprogram or pack‐
age body). Such files are also called bodies.
file.s
Assembler code.
file.S
Assembler code which must be preprocessed.
other
An object file to be fed straight into linking. Any file name with no
recognized suffix is treated this way.
You can specify the input language explicitly with the -x option:
-x language
Specify explicitly the language for the following input files (rather than
letting the compiler choose a default based on the file name suffix).
This option applies to all following input files until the next -x option.
Possible values for language are:
c c-header c-cpp-output
c++ c++-header c++-cpp-output
objective-c objective-c-header objective-c-cpp-output
objective-c++ objective-c++-header objective-c++-cpp-output
assembler assembler-with-cpp
ada
f77 f77-cpp-input ratfor
f95
java
treelang
-x none
Turn off any specification of a language, so that subsequent files are
handled according to their file name suffixes (as they are if -x has not
been used at all).
voilà...
http://www.linux-kheops.com/doc/man/manfr/man-html-0.9/man1/gcc.1.html
D' ou vient cette rumeur? Du fait que linux n'identifie pas les types de fichiers grâce à l'extension mais une entête MIME (me demandez pas trop de détails... ) fait croire à beaucoup que les extensions sont inutiles.
C'est très faux. L'entête MIME générée correspond à un fichier texte, et pas autre chose. GCC transforme un fichier texte en un code. Malheureusement GCC connaît plusieurs langages et il faut l'aider à reconnaître de quel langage il s'agit. Heureusement l'extension apporte au compilateur l'information qui va lui manquer: quel est le langage?
EXTRAITS DE MAN GCC
NAME
gcc - GNU project C and C++ compiler
gcc - GNU project C and C++ compiler
tout le monde me crois qu'il y a 2 langages reconnus... Passons à la ligne 416 et suivantes:
Options Controlling the Kind of Output
Compilation can involve up to four stages: preprocessing, compilation proper,
assembly and linking, always in that order. GCC is capable of preprocessing
and compiling several files either into several assembler input files, or into
one assembler input file; then each assembler input file produces an object
file, and linking combines all the object files (those newly compiled, and
those specified as input) into an executable file.
For any given input file, the file name suffix determines what kind of compi‐
lation is done:
file.c
C source code which must be preprocessed.
file.i
C source code which should not be preprocessed.
file.ii
C++ source code which should not be preprocessed.
file.m
Objective-C source code. Note that you must link with the libobjc library
to make an Objective-C program work.
file.mi
Objective-C source code which should not be preprocessed.
file.mm
file.M
Objective-C++ source code. Note that you must link with the libobjc
library to make an Objective-C++ program work. Note that .M refers to a
literal capital M.
file.mii
Objective-C++ source code which should not be preprocessed.
file.h
C, C++, Objective-C or Objective-C++ header file to be turned into a pre‐
compiled header.
file.cc
file.cp
file.cxx
file.cpp
file.CPP
file.c++
file.C
C++ source code which must be preprocessed. Note that in .cxx, the last
two letters must both be literally x. Likewise, .C refers to a literal
capital C.
file.hh
file.H
C++ header file to be turned into a precompiled header.
file.f
file.for
file.FOR
Fortran source code which should not be preprocessed.
file.F
file.fpp
file.FPP
Fortran source code which must be preprocessed (with the traditional pre‐
processor).
file.r
Fortran source code which must be preprocessed with a RATFOR preprocessor
(not included with GCC).
file.f90
file.f95
Fortran 90/95 source code which should not be preprocessed.
file.ads
Ada source code file which contains a library unit declaration (a declara‐
tion of a package, subprogram, or generic, or a generic instantiation), or
a library unit renaming declaration (a package, generic, or subprogram
renaming declaration). Such files are also called specs.
file.adb
Ada source code file containing a library unit body (a subprogram or pack‐
age body). Such files are also called bodies.
file.s
Assembler code.
file.S
Assembler code which must be preprocessed.
other
An object file to be fed straight into linking. Any file name with no
recognized suffix is treated this way.
You can specify the input language explicitly with the -x option:
-x language
Specify explicitly the language for the following input files (rather than
letting the compiler choose a default based on the file name suffix).
This option applies to all following input files until the next -x option.
Possible values for language are:
c c-header c-cpp-output
c++ c++-header c++-cpp-output
objective-c objective-c-header objective-c-cpp-output
objective-c++ objective-c++-header objective-c++-cpp-output
assembler assembler-with-cpp
ada
f77 f77-cpp-input ratfor
f95
java
treelang
-x none
Turn off any specification of a language, so that subsequent files are
handled according to their file name suffixes (as they are if -x has not
been used at all).
voilà...
http://www.linux-kheops.com/doc/man/manfr/man-html-0.9/man1/gcc.1.html