GNU GCC compiler will compile c++ source files with both .C and.cpp extension.
Is it possible to configure Microsoft Visual Studio so that it could compile the c++ source and header files with extensions .C and .H extension respectively?
The problem is that the Windows file system is not case-sensitive, so there's no difference between .c and .C. This means that the default C language for .c will always apply.
You cannot tell the compiler to generally treat .C files as C++, however you can tell it to treat files in a a compilation command as C++ regardless of their extension with the /TP switch.
.C extension in MVS?The command line option /TP tells the compiler to treat the source files as C++, even if the extension is something like .c.
In the IDE, you can set this as one of the project properties. Under C/C++, select Advanced Options and set the "Compile As" fields to C++.
.C extension as c++ ?