How Do I Compile and Link C Code, Not C++?
Give your files the .c extension, for example mysource.c
. The Visual C++ compiler automatically assumes that files with the .C extension are C files and not C++ files, and rejects C++ syntax and keywords (such as public, private, and class).
C++ files use the .cpp extension.
See the /TC, /TP compiler options for more information.