I have a dll
which I build using msbuild
with the command msbuild dll.vcxproj /p:Configuration=Debug
and it depends on a static lib
. My lib
have stdafx.h
and stdafx.cpp
and they are in different folders.
I am using /Yc
(create) for stdafx.cpp
and /Yu
(use) for the rest of the lib
. However, I got the error - fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory [lib path.vcxproj]
.
In my project settings (Visual Studio 2017), both the lib
and dll
do include the paths to both the stdafx.h
and stdafx.cpp
. I tried to specify the path to create the precompiled header in the properties of stdafx.cpp
but I got another error - C2857: '#include' statement specified with the /Ycstdafx.h command-line option was not found in the source file stdafx.cpp
.
I've also tried to include using relative path (i.e. #include "../path/stdafx.h"
) instead of just #include "stdafx.h"
inside stdafx.cpp
in lib
but I got the same error.
Edit: Since my header and source files are separated into different folders, I've tried moving the stdafx.h
into the folder of stdafx.cpp
and now, the compiler is able to find stdafx.h
but I have another error that my other .h
files that are included in stdafx.h
can't be found. This means that the issue will be solved if I merge my headers and source files into one folder but I want to keep them separated. Is there a way to specify the path of stdafx.h
other than the methods that I've tried?