Product Documentation

Building a Microsoft Visual Studio C Project for Your c-tree Application

Previous Topic

Next Topic

Step 7 - Make sure your source code will be compiled as C

Even though the default behavior of Visual Studio is to compile source code files that have a .c extension as C and to compile source code files that have a .cpp extension as C++, some versions of Visual Studio can have this default behavior overridden by the New Project Wizard (forcing everything to compile as C++). You can do the following to ensure this has not happened to your C project:

With the Property Pages window that we used in the previous step is still set to All Configurations and All Platforms, navigate to Configuration Properties > C/C++ > Advanced, and make sure the Compile As entry is set to Compile as C Code (/TC) or it is set to Default. The former forces Visual Studio to compile all source code files with the C compiler, regardless of the file name extension. The latter enables the default behavior (choosing a compiler based on the file name extension).

You can now dismiss the Property Pages window by clicking the OK button. Do not click the Cancel button or all the changes you made in steps 4-7 will be lost.

  • Save all of your changes to disk by selecting File > Save All from the menu bar.