Forcing GCC to compile .cpp file as C

The -x option for 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++)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)