Home c++ Where can I get stdafx.h in Visual Studio 2019?

Where can I get stdafx.h in Visual Studio 2019?




I installed Visual Studio, downloaded everything I needed, started working and saw that “stdafx” was missing.
Where can I find it in the public domain for download and where can I download it later?

Answer 1, authority 100%

stdafx.h is the default name precompiled header file in Visual Studio 2017 and earlier. As of VS2019, pch.h is used instead. It does not need to be downloaded from anywhere, header files are often included in the code to speed up compilation. The file itself should be created automatically when the project is created; but if it is not there, you can add it manually. The content should look something like this:

#pragma once
#include <stdio.h>
//other directivesinclude...

Together with it, the project should contain pch.cpp , consisting of a single line:

#include "pch.h"

To use precompiled headers, they must be enabled with the / Y parameter or via the project’s Configuration Properties & gt; C / C++ & gt; Precompiled Headers . After that, in each cpp-file at the very beginning (before any preprocessor directives or lines of code) you need to add #include "pch.h".

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions