Share via


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.