Some projects use .C as a file extension for C++ source code. This is ill-advised, because it is can't really be made to work automatically and reliably. Suppose we have a file source.C with the following contents:
Let's compile this with the default compiler on Linux:
$ cc -c -o /dev/null source.C
Note that that command is using the C compiler, not the C++ one. Still, the compiler will autodetect the type from the extension and compile it as C++. Now let's do the same thing using Visual Studio:
source.C(1): Error C2061 Syntax error: Identifier 'Foo'
<a bunch of other errors>
In this case Visual Studio has chosen to compile it as plain C. The defaults between these two compilers are the opposite and that leads to problems.
How to fix this?
The best solution is to change the file extension to an unambiguous one. The following is a simple ZSH snippet that does the renaming part:
Then you need to do the equivalent in your build files with search-and-replace.
If that is not possible, you need to use the /TP compiler switch with Visual Studio to make it compile the source as C++ rather than C. Note that if you use this argument on a target, then all files are built as C++, even the plain C ones. This is unreliable and can lead to weird bugs. Thus you should rename the files instead.