Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Visual Studio C++ 2010 Professional?

I'm trying to make the switch from EMACS to Visual Studio and am wanting to make life a little easier. What I'm wanting is to have it where every time I create a new .cpp, it is automatically filled with the following, since every .cpp I make contains this and I'd rather not have to type it out each time. Is there any way I could do this? Perhaps make a template? I'd appreciate some help here.

//----------------------------------------------------------------------------

// Documentation

//----------------------------------------------------------------------------

// Filename:

// Last Edited:

// Author:

// Email:

// Description:

//----------------------------------------------------------------------------

//----------------------------------------------------------------------------

// Directives

//----------------------------------------------------------------------------

#include <iostream>

#include <cstdlib>

#include <string>

#ifdef _WIN32

#define _USE_MATH_DEFINES

#include <math.h>

#else

#include <cmath>

#endif

#include <cassert>

using namespace std;

//----------------------------------------------------------------------------

// Named Constants

//----------------------------------------------------------------------------

//----------------------------------------------------------------------------

// Prototypes

//----------------------------------------------------------------------------

//----------------------------------------------------------------------------

// Function Definitions

//----------------------------------------------------------------------------

//----------------------------------------------------------------------------

int main()

{

return EXIT_SUCCESS;

}

//----------------------------------------------------------------------------

2 Answers

Relevance
  • 9 years ago
    Favorite Answer

    For C++, apparently, you create a Wizard, not a Template. MSDN documentation on this can be found, starting with Creating and Managing C++ Projects" at:

    http://msdn.microsoft.com/en-us/library/4457htyc.a...

    Visual Studio (Pro, not Express) has a Visual C++ "Custom Wizard" wizard. Googling "Visual C++ Wizard" turns up an article on using this:

    http://developergeeks.com/article/67/create-a-cust...

    There's also an article at CodeProject on developing your own C++ project wizards (in Visual C++ 2008 Express edition) at:

    http://www.codeproject.com/Articles/43653/Visual-C...

    Thanks for the question. Finding that last link was worth it. I've been unhappy with the standard C++ templates in VS Express for years now, but never realized I might add my own or maybe even customize the stock ones.

  • Anonymous
    9 years ago

    There might be better ways, but you can create the new project, and add only the code you want to reuse. It will create the directory for you, and you can just make a whole copy of the directory and rename it anything you want. To change the project name, right click in the solution explorer(after you open visual studio with the project copy), and click rename to change the name of the exe.

Still have questions? Get your answers by asking now.