-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
msbuild does not build precompiled header before building source file if UseMultiToolTask=true and path to the pch.h is relative #11403
Comments
BTW the bug does not occur when I do a |
Hi @yuehuang010, Could you please check if it belongs to custom C++ targets/tasks that might cause this issue? |
It is designed to use |
But you can also use |
MTT detect the pch dependency using the /Yu name to associate to the creating
|
What is the use case? Is it to address the Intellisense squiggle? A simple workaround is to add the pch path to the list of Include path. That will satisfy the compiler and intellisense. |
No it works fine (
|
Yes, otherwise everything gets red and code completion does not work. |
MTT will parallelize all work, but it needs information to create a DAG. Help set the edges directly. <ClCompile>
<MultiToolTaskDependency>pch.h</MultiToolTaskDependency>
</ClCompile> |
So normally when Do I have to set |
By default compile parallelism is off. Your options are 1) to enable the MSVC compiler parallelism via the switch /MP. or 2) Use task level MTT.
You can use <ItemDefinitionGroup>
<ClCompile>
<MultiToolTaskDependency>pch.h</MultiToolTaskDependency>
</ClCompile>
</ItemDefinitionGroup> |
Issue Description
I have the following project:
The content of the
Directory.Build.props
isand the
test/in-sub-folder.cpp
file has a#include "../pch.h"
If I try to compile the project I get
Steps to Reproduce
You can find an example project here: https://github.com/autoantwort/msbuild-bug-repro
Expected Behavior
The file in the subfolder should be compiled after the precompiled header is compiled
Actual Behavior
The file in the subfolder is compiled before the precompiled header is compiled
Analysis
It seems that msbuild misses the dependency on the precompiled header file.
Versions & Configurations
The text was updated successfully, but these errors were encountered: