I have two projects A and B. In project A, I have created a source file called Logger.cpp where I have #include "stdafx.h" in the includes part. The stdafx.h is present in the project A. In project A's properties, I have project B's header file locations in the 'Additional include directories' property. When I am trying to compile the solution in Visual Studio 2013 , it gets compiled successfully, but when I try to migrate my solution to Visual Studio 2019 and compile the whole solution, or only project A, I am getting the error E1696 cannot open source file "stdafx.h" .
What I have tried:
Both the above approach does not resolve the issue.
Am I missing something here?
According to Microsoft Docs , 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.)
So, you could set stdafx.h
in Properties->C/C++->Precompiled Header->Precompiled Header file
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.