[Tip: pch]How to reuse pch file on another pc?

How to reuse pch file on another pc?
MS doesn't officially announcethat the pch files that are produced on on pc can be reused on anyother pcs. But MS suggests you can use Incredibuild to do this.
You will receive below compile error:
fatal error C1027: Inconsistent values for /Ym between creation and use of precompiled headers
Answer from MS:
/Ym is an internal switch that is used between the driver (cl.exe) andthe parsers (c1.dll and c1xx.dll) it is used to pass the address of thecontiguous memory that has been reserved by cl.exe for the PCH. We dothis reservation in the driver so that we can reserve the memory asearly as possible in the process before too many DLLs have been loaded(and have grabed the memory we need). The compiler requires that thePCH is loaded at exactly the same address during a /Yu build as it wasduring a /Yc build -- the C1027 error you are seeing implies that in a/Yu build the driver was not able to reserve the memory at the requiredaddress.

 

Note: we do notofficially support using a PCH on different machine from the one onwhich it was created. Even if they machines are 100% identical it stillcan not be guaranteed that the preferred PCH address will be the sameon both machines.

I would suggest talking to Incredibuild -- they may be able to help you solve this issue.

Jonathan Caves
Visual C++ Compiler Team

posted @ 2010-03-27 20:32  能巴  阅读(705)  评论(0编辑  收藏  举报