c++visual-studiovisual-studio-2017pchdllmain

Removing extra files generated while creating a dll project in visual studio


While creating a dll project in VS17, I see multiple files were created on initialization.

enter image description here

But whichever project on C++ I work on, I don't see any such files in their environment. How can I get rid of these files in my environment. Is there any workaround to remove them entirely or reduce these 4 files to one file to reduce mess?

Also before VS17 we used to have stdafx.h, it is mandatory to include this header but in few projects I couldn't find this file, is there any way to remove these initial files entirely?


Solution

  • When you create a new project in Visual Studio, a precompiled header file named pch.h is added to the project. (In Visual Studio 2017 and earlier, the file was called stdafx.h.)

    For more details about pch.h and stdafx.h, I suggest you could refer to the Doc: Precompiled Header Files

    If you couldn't want to use precompiled header file, I suggest you could choose to not use precompiled headers (Configuration Properties > C/C++ > Precompiled Headers).

    When you create a dll project, you also directly choose uncheck Precompiled header or check Empty project. enter image description here

    enter image description here