The -x
option to gcc lets you specify the language of all input files following it:
$ gcc -x c your-file-name.cpp
If you only want to special-case that one file, you can use -x none
to shut off the special treatment:
$ gcc -x c your-filename.cpp -x none other-file-name.cpp
(your-filename.cpp
will be compiled as C, while other-file-name.cpp
will use the extension and compile as C++)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…