Rory 的个人资料dotNoted照片日志列表 工具 帮助
3月31日

On using namespace std, dealing with "Microsoft.VS80.DebugCRT could not be found" and resolving the LNK2022 VC++ linker error when converting from VS2005 to VS2008

This one was odd.

I had a VS2005 C++/CLI project, and in a recent iteration, had added some logging code using the standard library's streams package. One of the things I noticed early, by way of the program absolutely failing to get off the ground and writing an SxS exception to the system event log, was that including the standard library in the default Debug configuration resulted in the program acquiring a dependency on the Debug MSVCRT DLLs. I had been using the release DLLs (via compiler switch /MD) since I didn't want the hassle of having to make sure the non-redistributed Debug DLLs were on the build server and test machines, etc. Having weighed whether it was worth it for getting to include std, I decided it was, and made it a requirement to have the 4 required files (the 3 runtime DLLs and one manifest file) in the target dir at the build server and test machines. That solved the SxS error (Dependent Assembly Microsoft.VC80.DebugCRT could not be found... Last Error was "The referenced assembly is not installed on your system").

Then I switched over to VS2008. I figured it would be pretty seamless, since nothing really changed. However, I kept getting numerous LNK2022 error from the linker, like - "error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (std.domain_error)". There was obviously something wrong with including the standard library. If I commented out "using namespace std;" and all references to it (there were only a few), the program compiled. The linker was having problems with MSVCMRT.lib - the managed portion of the CRT. How could I change it, since VC++ picks it based on its version? The answer was to change the compile switch from /MD to /MDd for the project in the Debug configuration. Now the layout of the std types is the same, and the linker doesn't complain.

Why hadn't I needed to do this when the project was in VS2005? Perhaps the layout of debug and redist types in VS2005 were the same, or there was some special mode that VS2005 entered when it detected this usage pattern, and which is lost in the conversion.

评论 (4)

请稍候...
很抱歉,您输入的评论太长。请缩短您的评论。
您没有输入任何内容,请重试。
很抱歉,我们当前无法添加您的评论。请稍后重试。
若要添加评论,需要您的家长授予您相应权限。请求权限
您的家长禁用了评论功能。
很抱歉,我们当前无法删除您的评论。请稍后重试。
您已超过了一天之内允许提供的评论数上限。请在 24 小时后重试。
因为我们的系统表明您可能在向其他用户提供垃圾评论,您的帐户已禁用了评论功能。如果您认为我们错误地禁用了您的帐户,请联系 Windows Live 支持部门
完成下面的安全检查,您提供评论的过程才能完成。
您在安全检查中键入的字符必须与图片或音频中的字符一致。

若要添加评论,请使用您的 Windows Live ID 登录(如果您使用过 Hotmail、Messenger 或 Xbox LIVE,您就拥有 Windows Live ID)。登录


还没有 Windows Live ID 吗?请注册

没有名字发表:
http://www.bestlaptopbattery.com.au/ibm/thinkpad-t42.htm Ibm thinkpad t42 battery
http://www.bestlaptopbattery.com.au/ibm/thinkpad-t42p.htm Ibm thinkpad t42p battery
http://www.bestlaptopbattery.com.au/ibm/thinkpad-t43.htm Ibm thinkpad t43 battery
http://www.bestlaptopbattery.com.au/ibm/thinkpad-t43p.htm Ibm thinkpad t43p battery
http://www.bestlaptopbattery.com.au/ibm/thinkpad-t60.htm Ibm thinkpad t60 battery
http://www.bestlaptopbattery.com.au/ibm/thinkpad-t60p.htm Ibm thinkpad t60p battery
http://www.bestlaptopbattery.com.au/ibm/thinkpad-t61.htm Ibm thinkpad t61 battery
http://www.bestlaptopbattery.com.au/ibm/thinkpad-x40.htm Ibm thinkpad x40 battery
http://www.bestlaptopbattery.com.au/ibm/thinkpad-x41.htm Ibm thinkpad x41 battery
http://www.bestlaptopbattery.com.au/ibm/thinkpad-x61t.htm Ibm thinkpad x61t battery
http://www.bestlaptopbattery.com.au/ibm/thinkpad-z60m.htm Ibm thinkpad z60m battery
http://www.bestlaptopbattery.com.au/ibm/thinkpad-z60t.htm Ibm thinkpad z60t battery
http://www.bestlaptopbattery.com.au/ibm/thinkpad-z61e.htm Ibm thinkpad z61e battery
http://www.bestlaptopbattery.com.au/ibm/thinkpad-z61m.htm Ibm thinkpad z61m battery
http://www.bestlaptopbattery.com.au/ibm/thinkpad-z61p.htm Ibm thinkpad z61p battery
http://www.bestlaptopbattery.com.au/mitac/8050.htm Mitac 8050 battery
http://www.bestlaptopbattery.com.au/mitac/8375.htm Mitac 8375 battery
http://www.bestlaptopbattery.com.au/mitac/8575.htm Mitac 8575 battery
http://www.bestlaptopbattery.com.au/mitac/8575a.htm Mitac 8575a battery
http://www.bestlaptopbattery.com.au/mitac/8575p.htm Mitac 8575p battery
http://www.bestlaptopbattery.com.au/mitac/8x75.htm Mitac 8x75 battery
http://www.bestlaptopbattery.com.au/mitac/bp-8050.htm Mitac bp-8050 battery
http://www.bestlaptopbattery.com.au/mitac/bp-8089.htm Mitac bp-8089 battery
http://www.bestlaptopbattery.com.au/mitac/bp-8089p.htm Mitac bp-8089p battery
http://www.bestlaptopbattery.com.au/mitac/bp-8089x.htm Mitac bp-8089x battery
http://www.bestlaptopbattery.com.au/mitac/bp-8389.htm Mitac bp-8389 battery
http://www.bestlaptopbattery.com.au/mitac/bp-8599.htm Mitac bp-8599 battery
http://www.bestlaptopbattery.com.au/mitac/bp-8x99.htm Mitac bp-8x99 battery
http://www.bestlaptopbattery.com.au/mitac/e2000.htm Mitac e2000 battery
http://www.bestlaptopbattery.com.au/mitac/e680.htm Mitac e680 battery
http://www.bestlaptopbattery.com.au/mitac/mam2080.htm Mitac mam2080 battery
http://www.bestlaptopbattery.com.au/mitac/mim2120.htm Mitac mim2120 battery
http://www.bestlaptopbattery.com.au/mitac/mim2130.htm Mitac mim2130 battery
http://www.bestlaptopbattery.com.au/nec/m300.htm Nec m300 battery
http://www.bestlaptopbattery.com.au/nec/m500.htm Nec m500 battery
http://www.bestlaptopbattery.com.au/nec/op-570-75901.htm Nec op-570-75901 battery
http://www.bestlaptopbattery.com.au/nec/pc-vp-wp44.htm Nec pc-vp-wp44 battery
http://www.bestlaptopbattery.com.au/samsung/nc10.htm Samsung nc10 battery
http://www.bestlaptopbattery.com.au/sony/12-cell-vgp-bpl5a.htm Sony 12-cell vgp-bpl5a battery
http://www.bestlaptopbattery.com.au/sony/12-cell-vgp-bps5.htm Sony 12-cell vgp-bps5 battery
http://www.bestlaptopbattery.com.au/sony/12-cell-vgp-bps5a.htm Sony 12-cell vgp-bps5a battery
http://www.bestlaptopbattery.com.au/sony/bpl5.htm Sony bpl5 battery
http://www.bestlaptopbattery.com.au/sony/bps5.htm Sony bps5 battery
http://www.bestlaptopbattery.com.au/sony/bps5a.htm Sony bps5a battery
11 月 7 日
没有名字发表:
When the <a href="http://www.game4power.com/">Wow Gold </a> wolf finally found the <a href="http://www.game4power.com/">Buy Wow Gold</a>hole in the chimney he crawled <a href="http://www.game4power.com/buy-gold/">wow gold cheap </a> down and KERSPLASH right into that kettle of water and that was <a href="http://www.wowgoldone.com/"> cheapest wow gold </a> the end of his <a href="http://www.aocsale.com/">aoc gold </a>troubles with the big bad wolf.

The next day the <a href="http://www.wowgoldone.com/"><strong> cheap wow gold </strong></a><a href="http://www.game4power.com/">buy gold wow </a> little pig invited his mother over . She said "You see it is just as I told you. The way to <a href="http://www.gdpchina.org/">gdpchina</a>get along in the world is to do <a href="http://www.itemchannel.com/">world of warcraft gold</a> things as well as you can." Fortunately for that little pig, he <a href="http://www.mmopawn.net">mmopawn</a> learned that lesson. And he just lived happily ever after!
3 月 24 日
PlaireRory发表:
Is the project set to DEBUG?
10 月 15 日
i am having the same problem , but i am compiling with /MdD . I can't find the reason to this error.......
10 月 11 日

引用通告

此日志的引用通告 URL 是:
http://dotnoted.spaces.live.com/blog/cns!739DCC71898E38F9!395.trak
引用此项的网络日志