You may update the default models provided by MSCV.
I have no longer MSVC2013 installed but for MSVC2015 they are in directory C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcprojectitems
: hfile.h
for the headers, and newc++file.cpp
for cpp files.
Attention: to edit these files, you need to run your editor with administrator priviledge.
Another approach could be to create your own item templates. This is pretty easy: you start a project, add a .cpp
or a .h
, change it with the content you want to be used. Then export it (File->export template...). Here there is a step by step approach. You must make sure that at the end, the generated .zip
file is copied in your user's directory to the folder Visual Studio 2013\Templates\ItemTemplates
in the existing C++ subfolder.
Important notice: new templates might be taken into account at startup of MSVC only. SO be sure you exit and enter again MSVC to see the new templates added.
Edit following additional question in comments
In your templates you can use template parameters, that will be automatically replaced when the item is added to a project (provided ReplaceParameters="true"
in the .vstemplate
file of the exported template).
Example: a header template designed to ensure an include guard:
// $itemname$.h
// by $username$
#ifndef $safeitemname$_H
#define $safeitemname$_H
// TO DO: your guarded header here
#endif
When adding a new element using this header template, the paramter substitution will result in:
// my_funny_header.h
// by Christophe
#ifndef my_funny_header_H
#define my_funny_header_H
// TO DO: your guarded header here
#endif
Note however, that not all the paramters can be used. For example $projectname$ works only for project templates, not for itemtemplates. Note also that $safeitemname$
should be preferred to $itemname$
in symbol definition.