开发者

precompiled header .pch files are machine sensitive?

I tried to reuse the .pch to speed the build using the following way:

  1. use /Yc on stdafx.cpp to create the .pch files to a folder
  2. exc开发者_StackOverflow社区lude stdafx.cpp in the project, and modify the link option

It success in my machine, but failed in another, got the error message: error C2011: '***' : 'struct' type redefinition

So first I want to ask whether the .pch files are machine sensitive? then secondly, the above approaches workable?

Thanks!


Precompiled headers can be machine specific up to Visual Studio 2008 SP1 (from here):

Precompiled header files store the “state” of a compilation up to a certain point, and that state information can be reused in subsequent compiler invocations to significantly increase build throughput. For the past 15 years, our compiler has persisted precompiled headers to disk and reloaded them directly into virtual memory with 99.999% reliability and considerable performance gains. The tradeoff, however, was a degree of fragility in our architecture.

Since the PCH file itself contains internal pointers, it must be loaded at the exact same address in virtual memory where it was created.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜