Add C file in Visual Studio

I am using Microsoft Visual Studio 2010. When I add files to my project, they have an extension .cpp. To work with C, I need to manually rename the files to .c.

Is there a way to directly add C files without renaming anything?

+5
source share
5 answers

If I understand correctly, you want to directly add the C file to the project. Unfortunately, I do not think that VS provides any means for this; you just need to rename the recently added files.


You can rename the file from the IDE. Right-click the file and press rename (or click the file and press F2).

, F2. http://blackninjagames.com/images/rename_file.PNG

+5

( C File Plugin),

: Visual Studio - Template.zip

( ) ZIP :

C:\Users\USERNAME\Documents\Visual Studio 2013\Templates\ItemTemplates\

( VS2012):

C:\Users\USERNAME\Documents\Visual Studio 2013\Templates\ItemTemplates\Visual C++ Project

":

C:\Users\USERNAME\Documents\Visual Studio 2013\Templates\ItemTemplates\Visual C++ Project\Code

Tutorial, Visual Studio.

enter image description here

+4

When you add a new item, just add the extension to the "Name:" field and it will override the default value for the selected file type.

+3
source

Just add a text file and specify the extension, which will be .C

+2
source

I have not tried this, but you can create a template that causes the new file to be named with the default .c extension:

+1
source

All Articles