views:

412

answers:

1

When I create a new C/C++ header file in Visual Studio (2005/2008), I want to have some preprocessor header includes automatically inserted into the new header file. Anybody know how to do this? The New Porject and New Item template system in Visual Studio does not seem to apply to C++ files.

As an example, when I create foo.h, I want the following to be automatoically generated by the new file wizard:

#ifndef FOO_H
#define FOO_H


#endif // FOO_H

Update: The files that Visual Studio uses as templates to create new C++ source files are located in: C:\Program Files\Microsoft Visual Studio 8\VC\vcprojectitems (for Visual Studio 2005). Modifications to these files will be applied to any new files added to a C++ project. However, there does not appear to be a way to paramaterize the content within these files to allow the file name to be insserted etc. The search continues ...

+2  A: 

Buy Visual Assist X and use a snippet! Seriously, Visual Assist fills in so many holes in VS it's not funny. It's not expensive, and it will save you pulling your hair out.

20th Century Boy
I can do it manually via a macro/snippet but really want to be able to have this auto-magically. Does Virtual Assist X provide this?
Stephen Doyle
I don't think it does...but why don't you fire their support an email, they are very responsive, or ask the question on their forum. They really do take customer requests seriously, just check out their changelog.
20th Century Boy