Gaith
Gaith

Reputation: 828

Microsoft Visual C++ 2008 Express Edition: Can I insert default code in every .cpp file I create?

If I have for example this code:

#include <iostream>
#include <cstdio>
#include <fstream>
#include <string>

When I create an empty project with Visual C++ 2008, how to insert this code in every .cpp file I create in this project?

Upvotes: 3

Views: 326

Answers (2)

Ylisar
Ylisar

Reputation: 4291

Properties on the project then Configuration Properties -> C/C++ -> Advanced, there you will find a field for Force Includes. Just write the name of a header there which in turn contains the includes.

Upvotes: 1

Konstantin Dinev
Konstantin Dinev

Reputation: 34905

You can create an item template which would be a .cpp file with all the necessary includes. Then when you add a file to the project you would add that item instead of an empty .cpp file.

Item templates are located here:

%USER%\Documents\Visual Studio 2008\Templates\ItemTemplates

Guide on creating project and item templates.

Upvotes: 1

Related Questions