I'm using Visual Studio 2019, and whenever I create a new C++ project it gives me a default file with the following code:
// Template Test.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
This is so much unnecessary information and it takes a minute to change it to what I really want;
// Template Test.cpp : This file contains the 'main' function. Program execution begins and ends there.
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!\n";
}
It doesn't take very much time, but I have to do it every time I create a new C++ console project in VS 19.
After doing a quick search on my computer I found a folder called 'Templates' at the following location:
C:\Users\yale\Documents\Visual Studio 2019\Templates
This file has subdirectories that would lead me to think it's the right place, but none of the folders have any template files as I can see.
How can I modify the template files for different projects in C++ with Visual Studio 2019?
There are two ways you can choose any of them.
Use the Export Template Wizard:
Visual Studio provides an Export Template Wizard that can be used to update an existing template:
To manually update an existing template:
Also, you can visit the source page for more details.