简体   繁体   English

从依赖项中排除头文件以在Visual Studio 2017中进行构建

[英]Exclude a header file from the dependencies for a build in Visual Studio 2017

I have a larger MFC project. 我有一个较大的MFC项目。 Off course the resource.h file is used in a lot of cpp files. 当然,许多cpp文件中都使用resource.h文件。

Former VS version tracked the //{{NO_DEPENDENCIES}} comment at the start. VS的早期版本一开始就跟踪//{{NO_DEPENDENCIES}}评论。 The result was, that a change to the resource.h didn't cause a full recompile of all files using this header. 结果是,对resource.h的更改并未导致使用此标头对所有文件进行完全重新编译。

How can I achieve this with VS-2017? 如何使用VS-2017做到这一点?

I now that I need to manually trigger a recompile or a build all n major changes. 现在,我需要手动触发重新编译或构建所有n个主要更改。

How can I achieve this with VS-2017? 如何使用VS-2017做到这一点?

You can get details from this document . 您可以从此文档中获取详细信息。

The //{{NO_DEPENDENCIES}} is still supported in VS2017. //{{NO_DEPENDENCIES}}仍支持//{{NO_DEPENDENCIES}} If you add a new .rc file in VS2017, it will create a resource.h file, within it the comment will be at the first line. 如果在VS2017中添加新的.rc文件,它将创建一个resource.h文件,其中注释将位于第一行。

  • From document: 来自文件:

Visual C++, circumvents the dependency on RESOURCE.H by including the following comment as the first line of the RESOURCE.H file: Visual C ++通过包括以下注释作为RESOURCE.H文件的第一行,从而规避了对RESOURCE.H的依赖关系:

Also, if you have the need to frequently change symbol values for a certain group of resources, you will probably find it more convenient and safer to break out these symbols into a separate read-only header file, as described in the above section Including Additional Header Files . 另外,如果您需要经常更改某些资源组的符号值,则可能会发现将这些符号分解为单独的只读头文件更方便,更安全,如上一节“ 包含其他内容”中所述。头文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM