title: Forcing GCC to compile .cpp file as C
body: <p>I have an externally provided .cpp file. It is a mixture of C compatible code and a bit of C++ as well. The C++ code is just a wrapper around the C to take advantage of C++ features.</p>
  <p>It uses <code>#ifdef __cplusplus</code> macros to protect the C++ code, which is great. Unfortunately, if I try to compile using GCC, it treats it as C++ because of the file ending. I'm aware of the differences between <code>gcc</code> and <code>g++</code> - I don't want to compile as C++.</p>
  <p>Is there any way I can force GCC to treat this file as a C file? I've tried using e.g. <code>--std=c99</code>, but this correctly produces the error that C99 isn't valid for C++.</p>
  <p>Renaming the file to .c works, but I'd like to avoid this if possible because it's externally provided and it'd be nice for it to remain as a pristine copy.</p>