fatal error C1900: Il mismatch between 'P1' version '20080116' and 'P2' version '20070207'

以下是截取一段,原文地址:http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/9abfefe0-56bd-4a82-ae14-b08f262972bd


I once handled a similar case in newsgroups. That case exhibit a almost same symptom. Please check out my summary below:
 
Problem
In that case, the customer has a DLL project that you had built on a machine where VS 2008 SP1 was installed. You then attempted to rebuild that project on a machine without SP1, and got a fatal compiler error C1900 “IL mismatch between ‘P1’ version ‘20080116’ and ‘P2’ version ‘20070207’”, and then LNK1257 “Code generation failed”. He found that rebuilding your static library alleviated the errors, but cannot accept this as a workaround because your clients will not have the ability to rebuild the libraries you distribute before they use them.
 
Cause(原因)
You had built the static library with the /GL (Whole Program Optimization) compiler switch, which requires Link Time Code Generation (/LTCG) when the static library is subsequently linked. These features require that all linked modules be built by the same version of the compiler. In fact, if precompiled headers are used, the same machine must build and link all the involved object code. Therefore, it is highly recommended that static libraries not be built with the /GL switch, since their intended use is quite frequently to support reuse by others.
 
Solution
You rebuilt the static library on your VS2008 SP1 machine without the /GL switch, and you no longer encounter this problem.
 
Please let me know if this info is helpful to you or not.


这里的解决方法是,将项目属性—C/C++—optimization(优化)—Whole Program Optimization(全程序优化)关掉。

对我遇到的情况,适用。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值