c++visual-studioprecompiled-headerspchstdafx.h

Visual Studio C++ console application


I recently had to reinstall visual studio. Previously when I chose Windows Console Application it would load with #include "stdafx.h". Now for some reason it loads with #include "pch.h" and a "hello world" program. I just want it to default load with stdafx.h and int main { return 0} like it used to. I need the stdafx.h, it's a requirement for my school projects so I would really like for it to load up as a default like before. Any help would be greatly appreciated. I posted an image of how it loads up now.

Visual Studio pch.h


Solution

  • Simply create a new template.

    1. Create a new console application.
    2. Edit the file to be as you want it in the new one.
    3. Select "Export Template..." in the "File" menu.
    4. Walk through the wizard (choose a name for your new template, etc.)
    5. Be sure the "Automatically import the template into Visual Studio" is checked.
    6. Restart VS
    7. Select "New Project"
    8. Select "Visual C++" in the tree control on the left
    9. Select your new template in the list in the middle
    10. The usual new-project stuff (name and location for the project, etc.)

    Source: How do I set up Visual Studio with default headers and comments?