﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-我的编程乐园-文章分类-常见编译器错误解决办法</title><link>http://www.cppblog.com/deercoder/category/12312.html</link><description>思考至上</description><language>zh-cn</language><lastBuildDate>Mon, 14 Dec 2009 19:20:01 GMT</lastBuildDate><pubDate>Mon, 14 Dec 2009 19:20:01 GMT</pubDate><ttl>60</ttl><item><title>【转载】编译错误＂MSVCRTD.lib(MSVCRTD.dll):errorLNK2005</title><link>http://www.cppblog.com/deercoder/articles/103122.html</link><dc:creator>刘畅</dc:creator><author>刘畅</author><pubDate>Sun, 13 Dec 2009 09:41:00 GMT</pubDate><guid>http://www.cppblog.com/deercoder/articles/103122.html</guid><wfw:comment>http://www.cppblog.com/deercoder/comments/103122.html</wfw:comment><comments>http://www.cppblog.com/deercoder/articles/103122.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/deercoder/comments/commentRss/103122.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/deercoder/services/trackbacks/103122.html</trackback:ping><description><![CDATA[<h1 class=contents_header>&nbsp;</h1>
<!-- 页码和简介 -->
<div class=contents_main>
<div class=content_words id=ArticleCnt style="FONT-SIZE: 14px">
<pre>
<div>今天在编译vc工程时出现的错误，并在网上找到了解决方法，有类似问题的请参照</div>
<div>本人在编译VC6.0工程时，遇到如下错误：<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; error &nbsp; LNK2005: &nbsp; _getenv &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(getenv.obj)<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; error &nbsp; LNK2005: &nbsp; _free &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(dbgheap.obj)<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; error &nbsp; LNK2005: &nbsp; _calloc &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(dbgheap.obj)<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; error &nbsp; LNK2005: &nbsp; _malloc &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(dbgheap.obj)<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; error &nbsp; LNK2005: &nbsp; _printf &nbsp; already &nbsp; defined &nbsp; in &nbsp; xlibgui.lib(PRINTF.OBJ)<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; error &nbsp; LNK2005: &nbsp; _fflush &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(fflush.obj)<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; error &nbsp; LNK2005: &nbsp; _sprintf &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(sprintf.obj)<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; error &nbsp; LNK2005: &nbsp; _strncpy &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(strncpy.obj)<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; error &nbsp; LNK2005: &nbsp; _atoi &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(atox.obj)<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; error &nbsp; LNK2005: &nbsp; _realloc &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(dbgheap.obj)<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; error &nbsp; LNK2005: &nbsp; _signal &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(winsig.obj)<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; error &nbsp; LNK2005: &nbsp; __controlfp &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(ieee87.obj)<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; error &nbsp; LNK2005: &nbsp; _exit &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(crt0dat.obj)<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _getenv &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(getenv.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _free &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(dbgheap.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _calloc &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(dbgheap.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _malloc &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(dbgheap.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _printf &nbsp; already &nbsp; defined &nbsp; in &nbsp; xlibgui.lib(PRINTF.OBJ); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _fflush &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(fflush.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _sprintf &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(sprintf.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _strncpy &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(strncpy.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _atoi &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(atox.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _realloc &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(dbgheap.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _signal &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(winsig.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; __controlfp &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(ieee87.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _exit &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(crt0dat.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _fclose &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(fclose.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _fopen &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(fopen.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; __stricmp &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(stricmp.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _fprintf &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(fprintf.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>MSVCRTD.lib(MSVCRTD.dll) &nbsp; : &nbsp; warning &nbsp; LNK4006: &nbsp; _ceil &nbsp; already &nbsp; defined &nbsp; in &nbsp; LIBCMTD.lib(ceil.obj); &nbsp; second &nbsp; definition &nbsp; ignored<br>&nbsp; &nbsp; &nbsp; Creating &nbsp; library &nbsp; Debug/shm_ext_sim.lib &nbsp; and &nbsp; object &nbsp; Debug/shm_ext_sim.exp<br>LINK &nbsp; : &nbsp; warning &nbsp; LNK4098: &nbsp; defaultlib &nbsp; "MSVCRTD" &nbsp; conflicts &nbsp; with &nbsp; use &nbsp; of &nbsp; other &nbsp; libs; &nbsp; use &nbsp; /NODEFAULTLIB:library<br>LINK &nbsp; : &nbsp; warning &nbsp; LNK4098: &nbsp; defaultlib &nbsp; "MSVCRT" &nbsp; conflicts &nbsp; with &nbsp; use &nbsp; of &nbsp; other &nbsp; libs; &nbsp; use &nbsp; /NODEFAULTLIB:library<br>Debug/shm_ext_sim.exe &nbsp; : &nbsp; fatal &nbsp; error &nbsp; LNK1169: &nbsp; one &nbsp; or &nbsp; more &nbsp; multiply &nbsp; defined &nbsp; symbols &nbsp; found<br>Error &nbsp; executing &nbsp; link.exe.<br><br>shm_ext_sim.exe &nbsp; - &nbsp; 37 &nbsp; error(s), &nbsp; 86 &nbsp; warning(s)</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>原因及解决方法：</div>
<div>主程序和lib所使用的运行库不一致，project-&gt;setting-&gt; Generation-&gt;Use MFC Static Library<br><br>
<table style="COLOR: #02368d; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=700 align=center border=0>
    <tbody>
        <tr height=25>
            <td width=120>网友：<strong>本站网友</strong></td>
            <td style="COLOR: #aaaaaa" align=right width=555>时间：2006-08-27 14:24:11 IP地址：202.194.210.★ </td>
        </tr>
        <tr>
            <td bgColor=#d2dee2 colSpan=3 height=1></td>
        </tr>
        <tr>
            <td bgColor=#ffffff colSpan=3 height=1></td>
        </tr>
        <tr>
            <td colSpan=3>
            <table style="BORDER-COLLAPSE: collapse; WORD-WRAP: break-word" borderColor=#111111 cellSpacing=0 cellPadding=0 width=700 border=0>
                <tbody>
                    <tr>
                        <td vAlign=top width=20></td>
                        <td width=580>For example, if you received this warning and you want to create an executable file that uses the non-debug, single-threaded version of the run-time libraries, you could use the following options with the linker: <br><br>/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib <br><br>或者这样：For example, if you received this warning and you want to create an executable file that uses the non-debug, single-threaded version of the run-time libraries, you could use the following options with the linker:<br><br>/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB写程序看到 warning，感觉不爽。 这个警告在 link option 中 加入 对应的 /NODEFAULTLIB:xxx.lib 　　就ok了<br></td>
                    </tr>
                </tbody>
            </table>
            </td>
        </tr>
    </tbody>
</table>
<br><br></div>
</pre>
</div>
</div>
<img src ="http://www.cppblog.com/deercoder/aggbug/103122.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/deercoder/" target="_blank">刘畅</a> 2009-12-13 17:41 <a href="http://www.cppblog.com/deercoder/articles/103122.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VC的编译预处理 ，can't find "/pch" </title><link>http://www.cppblog.com/deercoder/articles/102619.html</link><dc:creator>刘畅</dc:creator><author>刘畅</author><pubDate>Sat, 05 Dec 2009 12:37:00 GMT</pubDate><guid>http://www.cppblog.com/deercoder/articles/102619.html</guid><wfw:comment>http://www.cppblog.com/deercoder/comments/102619.html</wfw:comment><comments>http://www.cppblog.com/deercoder/articles/102619.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/deercoder/comments/commentRss/102619.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/deercoder/services/trackbacks/102619.html</trackback:ping><description><![CDATA[<p>预编译头文件</p>
<p>今天在改一个很大的程序，慢慢看，慢慢改。突然发现一个.c文件，里面什么也没有， 就几个头文件，我一看，我靠，这不是把简单的问题搞复杂了吗，随手删掉那个c文件。 结果不能编译了，我靠： <br>fatal error C1083: Cannot open precompiled header file: Debug/v13_3.pch\': No such file or directory <br>怎么rebuild all都不行。 上网查了一下，才搞懂了： <br>－－－－－－－－－－－－－－－－总结－－－－－－ <br>如果工程很大，头文件很多，而有几个头文件又是经常要用的，那么 <br>1。把这些头文件全部写到一个头文件里面去，比如写到preh.h <br>2。写一个preh.c，里面只一句话：#include "preh.h" <br>3。对于preh.c，在project setting里面设置creat precompiled headers，对于其他 .c文件，设置use precompiled header file <br>// 哈哈 我试了一下，效果很明显，不用precompiled header，编译一次我可以去上个厕所，用 precompiled header，编译的时候，我可以站起来伸个懒腰，活动活动就差不多啦 <br>&nbsp;</p>
<p>－－－－－－－－－--－－－－－－－－－－ <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 预编译头的概念： 所谓的预编译头就是把一个工程中的那一部分代码,预先编译好放在一个文件里(通常是 以.pch为扩展名的)，这个文件就称为预编译头文件这些预先编译好的代码可以是任何的 C/C++代码--------甚至是inline的函数，但是必须是稳定的，在工程开发的过程中不会 被经常改变。如果这些代码被修改，则需要重新编译生成预编译头文件。注意生成预编 译头文件是很耗时间的。同时你得注意预编译头文件通常很大，通常有6-7M大。注意及时清理那些没有用的预编译头文件。 <br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 也许你会问：现在的编译器都有Time stamp的功能，编译器在编译整个工程的时候，它只会编译那些经过修改的文件，而不会去编译那些从上次编译过，到现在没有被修改过的文件。那么为什么还要预编译头文件呢？答案在这里，我们知道编译器是以文件为单位编译的，一个文件经过修改后，会重新编译整个文件，当然在这个文件里包含的所有头文件中的东西（.eg Macro, Preprocesser ）都要重新处理一遍。VC的预编译头文件保存的正是这部分信息。以避免每次都要重新处理这些头文件。 </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 预编译头的作用：根据上文介绍，预编译头文件的作用当然就是提高便宜速度了，有了它你没有必要每次都编译那些不需要经常改变的代码。编译性能当然就提高了。 </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 预编译头的使用：要使用预编译头，我们必须指定一个头文件，这个头文件包含我们不会经常改变的代码和其他的头文件，然后我们用这个头文件来生成一个预编译头文件（.pch文件）</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 想必大家都知道 StdAfx.h这个文件。很多人都认为这是VC提供的一个&#8220;系统级别&#8221;的，编译器带的一个头文件。其实不是的，这个文件可以是任何名字的。我们来考察一个典型的由AppWizard生成的MFC Dialog Based　程序的预编译头文件。（因为AppWizard会为我们指定好如何使用预编译头文件，默认的是StdAfx.h，这是VC起的名字）。我们会发现这个头文件里包含了以下的头文件： <br>#include &lt;afxwin.h&gt; // MFC core and standard components <br>#include &lt;afxext.h&gt; // MFC extensions <br>#include &lt;afxdisp.h&gt; // MFC Automation classes <br>#include &lt;afxdtctl.h&gt; // MFC support for Internet Explorer 4 <br>Common Controls <br>#include &lt;afxcmn.h&gt; </p>
<p>&nbsp;</p>
<p><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这些正是使用MFC的必须包含的头文件，当然我们不太可能在我们的工程中修改这些头文件的，所以说他们是稳定的。 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 那么我们如何指定它来生成预编译头文件。我们知道一个头文件是不能编译的。所以我们还需要一个cpp文件来生成.pch 文件。这个文件默认的就是StdAfx.cpp。在这个文件里只有一句代码就是：#include &#8220;Stdafx.h&#8221;。原因是理所当然的，我们仅仅是要它能够编译而已?D?D?D也就是说，要的只是它的.cpp的扩展名。我们可以用/Yc编译开关来指定StdAfx.cpp来生成一个.pch文件，通过/Fp编译开关来指定生成的pch文件的名字。<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 打开project -&gt;Setting-&gt;C/C++ 对话框。把Category指向Precompiled Header。在左边的树形视图里选择整个工程Project Options(右下角的那个白的地方)可以看到 /Fp &#8220;debug/PCH.pch&#8221;，这就是指定生成的.pch文件的名字，默认的通常是　&lt;工程名&gt;.pch（我的示例工程名就是PCH）。然后，在左边的树形视图里选择StdAfx.cpp.//这时只能选一个cpp文件！这时原来的Project Option变成了 Source File Option（原来是工程，现在是一个文件，当然变了）。在这里我们可以看到 /Yc开关，/Yc的作用就是指定这个文件来创建一个Pch文件。/Yc后面的文件名是那个包含了稳定代码的头文件，一个工程里只能有一个文件的可以有YC开关。VC就根据这个选项把 StdAfx.cpp编译成一个Obj文件和一个PCH文件。然后我们再选择一个其它的文件来看看，//其他cpp文件在这里，Precomplier 选择了 Use ⋯⋯⋯一项，头文件是我们指定创建PCH 文件的stdafx.h文件。事实上，这里是使用工程里的设置， /Yu&#8221;stdafx.h&#8221;。这样，我们就设置好了预编译头文件。也就是说，我们可以使用预编译头功能了。<br>&nbsp;<br>&nbsp;<br>以下是注意事项： <br>1):如果使用了/Yu，就是说使用了预编译，我们在每个.cpp文件的最开头，我强调一遍是最开头，包含 你指定产生pch文件的.h文件（默认是stdafx.h）不然就会有问题。如果你没有包含这个文件，就告诉你Unexpected file end. 如果你不是在最开头包含的，你自己试以下就知道了，绝对有很惊人的效果⋯.. <br>fatal error C1010: unexpected end of file while looking for precompiled header directive Generating Code... </p>
<p><br>2）如果你把pch文件不小心丢了，编译的时候就会产生很多的不正常的行为。根据以上的分析，你只要让编译器生成一个pch文件。也就是说把 stdafx.cpp（即指定/Yc的那个cpp文件）从新编译一遍。当然你可以傻傻的 Rebuild All。简单一点就是选择那个cpp文件，按一下Ctrl + F7就可以了。不然可是很浪费时间的哦。 </p>
<p><a href="http://blog.csdn.net/blackboyofsnp/archive/2009/11/11/4796124.aspx"></a>&nbsp;</p>
<img src ="http://www.cppblog.com/deercoder/aggbug/102619.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/deercoder/" target="_blank">刘畅</a> 2009-12-05 20:37 <a href="http://www.cppblog.com/deercoder/articles/102619.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VC6.0与vista 的冲突问题解决！ VS 2008惹的祸！！！</title><link>http://www.cppblog.com/deercoder/articles/102112.html</link><dc:creator>刘畅</dc:creator><author>刘畅</author><pubDate>Fri, 27 Nov 2009 13:42:00 GMT</pubDate><guid>http://www.cppblog.com/deercoder/articles/102112.html</guid><wfw:comment>http://www.cppblog.com/deercoder/comments/102112.html</wfw:comment><comments>http://www.cppblog.com/deercoder/articles/102112.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/deercoder/comments/commentRss/102112.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/deercoder/services/trackbacks/102112.html</trackback:ping><description><![CDATA[最开始安装了VC6.0，VS2005没有任何问题，之后安装了VS2008，问题就出来了，每次用VC6.0打开或添加项目时出现【MSDEV.EXE-应用程序错误"0x73d311c7"指令引用的"0x00000004"内存,该内存不能为"read"】，开始没有发现是哪里什么问题，后面因为必须用VC6.0开发，不得不试了好多版本，都不行，于是只好重新安装系统。<br>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> 第二次开始安装了VC6.0和VS2008，运行起来没有问题，当我安装上office2007的时候，上面的问题又出来了，于是卸掉office2007，VC6.0又正常了。于是仔细的观察了一下office2007和VS2005有什么相似的，终于发现了出现问题的原因。<br>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> VS2005和office2007里面都包括组件.net framework2.0，而VS2008包括的是.net framework3.5，当主机上同时有.net framework 2.0和.net framework 3.5的时候，会造成VC6.0编译环境的改变，发生不可预料的错误，最根本的原因那当然得去问微软了。<br>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> 解决办法：安装不带.net framework2.0的精简版office2007（已经试过，我正在用），还有就是网上一种曲线救国的方法，下面分享一下：<br>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> 首先去下载一个FileTool(http://download.microsoft.com/download/vc60ent/s1/6.0/w9xnt4/en-us/filetool.exe 下载后解压缩)，下载过来是一个C++原始文件，需要通过VC编译一下产生一个 FileTool.dll<br>将这个插件复制到<br>X:\Program Files\Microsoft Visual Studio\Common\MSDev98\AddIns<br>重新打开VC6，Tools-&gt;Customize-&gt;Add-ins and Macro Files,选中FileTool Developer Studio Add-in即可。<br>此时打开VC6会有一个浮动工具栏（A O），点击A就是添加文件到工程，点击O就是打开文件。是不是很怪啊，竟然做了一个插件进来，并没有对原先的冲突进行改进。<br>以下的错误也随之解决：<br>Access Violation (0xC0000005) in DEVSHL.DLL at 0x5003eaed.<br>DevShl.Dll referenced memory at 0x0000000. The memory could not be read. 
<img src ="http://www.cppblog.com/deercoder/aggbug/102112.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/deercoder/" target="_blank">刘畅</a> 2009-11-27 21:42 <a href="http://www.cppblog.com/deercoder/articles/102112.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VS2005中出现无法找到调试信息的解决方法</title><link>http://www.cppblog.com/deercoder/articles/102099.html</link><dc:creator>刘畅</dc:creator><author>刘畅</author><pubDate>Fri, 27 Nov 2009 13:19:00 GMT</pubDate><guid>http://www.cppblog.com/deercoder/articles/102099.html</guid><wfw:comment>http://www.cppblog.com/deercoder/comments/102099.html</wfw:comment><comments>http://www.cppblog.com/deercoder/articles/102099.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/deercoder/comments/commentRss/102099.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/deercoder/services/trackbacks/102099.html</trackback:ping><description><![CDATA[<div>
<p style="MARGIN: 0in; FONT-FAMILY: simsun; FONT-SIZE: 10pt"><strong>首先打开菜单 项目-&gt;项目属性 (Alt+F7)页:</strong></p>
<p style="MARGIN: 0in; FONT-FAMILY: simsun; FONT-SIZE: 10pt">&nbsp;<wbr><wbr></p>
<p style="MARGIN: 0in; FONT-FAMILY: simsun; FONT-SIZE: 10pt"><strong>1 选择配置属性-&gt;链接器-&gt;调试-&gt;生成调试信息改为是</strong></p>
<p style="MARGIN: 0in; FONT-FAMILY: simsun; FONT-SIZE: 10pt">&nbsp;<wbr><wbr></p>
<p style="MARGIN: 0in; FONT-FAMILY: simsun; FONT-SIZE: 10pt"><strong>2 选择 配置属性-&gt;C/C++ -&gt;常规-&gt;调试信息格式改为用于&#8220;编辑并继续&#8221;的程序数据库(/ZI)</strong></p>
<p style="MARGIN: 0in; FONT-FAMILY: simsun; FONT-SIZE: 10pt">&nbsp;<wbr><wbr></p>
<p style="MARGIN: 0in; FONT-FAMILY: simsun; FONT-SIZE: 10pt"><strong>3 选择 配置属性-&gt;C/C++ -&gt;优化-&gt;优化 改为 自定义</strong></p>
<p style="MARGIN: 0in; FONT-FAMILY: simsun; FONT-SIZE: 10pt">&nbsp;<wbr><wbr></p>
<p style="MARGIN: 0in; FONT-FAMILY: simsun; FONT-SIZE: 10pt"><strong>重新编译，运行,ok</strong></p>
</div>
<img src ="http://www.cppblog.com/deercoder/aggbug/102099.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/deercoder/" target="_blank">刘畅</a> 2009-11-27 21:19 <a href="http://www.cppblog.com/deercoder/articles/102099.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【转载】R6034错误，C Runtime Error</title><link>http://www.cppblog.com/deercoder/articles/101006.html</link><dc:creator>刘畅</dc:creator><author>刘畅</author><pubDate>Sun, 15 Nov 2009 11:51:00 GMT</pubDate><guid>http://www.cppblog.com/deercoder/articles/101006.html</guid><wfw:comment>http://www.cppblog.com/deercoder/comments/101006.html</wfw:comment><comments>http://www.cppblog.com/deercoder/articles/101006.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/deercoder/comments/commentRss/101006.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/deercoder/services/trackbacks/101006.html</trackback:ping><description><![CDATA[<p>这是我转的一篇非常全的帖子&nbsp;</p>
<p>能查到的解决方法都在里面有提及:&nbsp;</p>
<p>我是使用 stdafx.h加入这句</p>
<p>code #pragma comment(linker, "\"/manifestdependency:type='Win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='X86' publicKeyToken='1fc8b3b9a1e18e3b' language='*'\"") 解决的&nbsp;</p>
<p>vs2008的话改成VC90.CRT&nbsp;</p>
<p>version='8.0.50608.0'&nbsp;改成你的vs的版本.&nbsp;</p>
<p><br></p>
<p>以下是转载的全文 &nbsp; &nbsp;</p>
<p>一个项目从vc6迁移到VS2005，在修改了一系列的类型警告后。编译成功了，Debug的时候，结果却冒出一个R6034错误："An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information."<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Output Window:app.exe 中的 0x7c984ed1 处最可能的异常: 0xC0000142: DLL Initialization Failed。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 编译条件是：Linker-&gt;Manifest File -&gt;Allow Isolation:Yes。 </p>
<div>&nbsp;&nbsp;&nbsp; 在同样的编译条件下，Release则可以正常编译运行。</div>
<div>采取解决措施：在stdafx.h文件中加入：</div>
<div>#pragma comment(linker, "\"/manifestdependency:type='Win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='X86' publicKeyToken='1fc8b3b9a1e18e3b' language='*'\"")<br>&nbsp;&nbsp; 之后，调试中出现若干错误,屏蔽掉错误代码，可以运行，只是最前面的一个splash窗体没有了。<br>&nbsp;&nbsp; (参考：<a href="http://forums.microsoft.com/china/ShowPost.aspx?PostID=1988459&amp;SiteID=15"><u><font color=#0066ff>http://forums.microsoft.com/china/ShowPost.aspx?PostID=1988459&amp;SiteID=15</font></u></a>)</div>
<div></div>
<div>在此之前，参考了很多关于R6034错误的网页，主要是考虑manifest：</div>
<div>&nbsp;&nbsp;&nbsp; （1）磁盘系统是fat32格式的：FAT32的时间精度不够,所以linker在生成文件的时候会出错，如果是ntfs的就没有问题.VS2005项目设置里面在清单工具（Manifest Tool）下面有一个选项"使用FAT32解决办法"(Use FAT32 work around)是专门解决这个问题的.对于FAT32的磁盘，需要选择"Yes"，默认是"No".</div>
<div>&nbsp;&nbsp;&nbsp; (2)Visual Studio 2005用向导生成的项目，在运行时可能会遇到找不到MFC80UD.dll的问题。这个问题可能是Manifest 引起的，因此我们可以通过修改项目属性(properties)-&gt;清单工具(property pages)-&gt;链接(linker)--&gt;manifest file --&gt;Allow Isolation，把&#8220;嵌入清单&#8221;选&#8220;否&#8221;，.然后编译、链接、运行即可。</div>
<div>Visual Studio 2005用向导生成的项目，在运行时可能会遇到找不到MFC80UD.dll的问题。这个问题可能是Manifest 引起的，因此我们可以通过修改项目属性-&gt;清单工具-&gt;输入输出，把&#8220;嵌入清单（Embed Manifest）&#8221;选&#8220;否&#8221;，.然后编译、链接、运行即可。</div>
<div>&nbsp;&nbsp;&nbsp; (3)有人提示，在项目属性里，mfc的使用应该设置为静态链接。但我改成静态后，会有很多错误，于是放弃。</div>
<div>&nbsp;&nbsp;&nbsp; （4）问了一个论坛上的网友，他说可能和Microsoft C++ Runtime Library有关系。</div>
<div></div>
<div></div>
<div><br></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp; 除此之外，一个参考文献上说的解决方法是：将Linker-&gt;Manifest File -&gt;Allow Isolation：Do not Allow Side by Side isolation，则无论在Debug和Release条件，都出现如下：This application has failed to start because MSVCR80D.dll was not found. Re-installing the application may fix the problem."</div>
<div>&nbsp;&nbsp;&nbsp; 关于这个问题，有篇博客文章上说：
<div><a href="http://www.cnblogs.com/StoneTao/archive/2006/09/26/515387.html"><u><font color=#0066ff>VS2005在FAT32分区的介质上对于Win32程序编译的一些注意</font></u></a></div>
问题描述：大部分的vs.net 2005的用户在新建&#8220;win32项目－windows应用程序&#8221;的时候，新建的工程都通不过去，出现如下提示：&nbsp;<br>Solution to &#8220;MSVCR80D.dll not found&#8221;<br>&#8220;没有找到MSVCR80D.dll，因此这个应用程序未能启动。重新安装应用程序可能会修复此问题。&#8221;<br><br><strong>问题所在</strong>：由于vs.net 2005 采用了一种新的DLL方案，搞成一个exe还要配有一个manifest文件（一般在嵌入文件里了，所以看不到，不过也可以不嵌入，这样会生产一个&lt;程序名&gt;.exe.manifest的文件，没它exe自己就转不了了：）这是个新功能，微软弄了个新工具（mt.exe），结果不好用，好像是fat32下时间戳有问题（在ntfs下这个问题就没有了），搞得manifest有时嵌入不到exe中（默认配置是嵌入的，所以就报错找不到dll了。&nbsp;<br><br>解决方案<br><strong>1． 微软的解决方案。<br></strong>　　在&#8220;属性-&gt;配置属性-&gt;清单工具-&gt;常规&#8220;下有一个&#8221;使用FAT32解决办法，设置为"是"<br><strong>2．</strong>&nbsp;找到你的工程的文件夹，如（myproject），找到其下的myproject\myproject\Debug\，Delete it.</div>
<div></div>
<div></div>
<div>参考：</div>
<div>&nbsp;&nbsp;&nbsp; 1。<a href="http://www.grimes.demon.co.uk/workshops/fusWSThirteen.htm"><u><font color=#0066ff>http://www.grimes.demon.co.uk/workshops/fusWSThirteen.htm</font></u></a></div>
<div>&nbsp;&nbsp;&nbsp; 2。<a href="http://blogs.msdn.com/nikolad/articles/427101.aspx"><u><font color=#0066ff>http://blogs.msdn.com/nikolad/articles/427101.aspx</font></u></a></div>
<div>&nbsp;&nbsp;&nbsp; 3。<a href="http://blog.csdn.net/fjnucse/archive/2007/09/06/1774190.aspx"><u><font color=#0066ff>http://blog.csdn.net/fjnucse/archive/2007/09/06/1774190.aspx</font></u></a></div>
<div>&nbsp;&nbsp;&nbsp; 4。<a href="http://msdn2.microsoft.com/zh-cn/library/ms235560(vs.80).aspx"><u><font color=#0066ff>http://msdn2.microsoft.com/zh-cn/library/ms235560(vs.80).aspx</font></u></a></div>
<div>&nbsp;&nbsp;&nbsp; 5。<a href="http://www.3800hk.com/Article/cxsj/cjiajia/txtxdmtcjj/2007-04-02/Article_125561.html"><u><font color=#0066ff>http://www.3800hk.com/Article/cxsj/cjiajia/txtxdmtcjj/2007-04-02/Article_125561.html</font></u></a></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp; 6。<a href="http://msdn2.microsoft.com/en-us/library/ms235342.aspx"><u><font color=#0066ff>http://msdn2.microsoft.com/en-us/library/ms235342.aspx</font></u></a></div>
<div>&nbsp;&nbsp;&nbsp; 7。<a href="http://msdn2.microsoft.com/en-us/library/ms235624(VS.80).aspx"><u><font color=#0066ff>http://msdn2.microsoft.com/en-us/library/ms235624(VS.80).aspx</font></u></a></div>
<div>&nbsp;&nbsp;&nbsp; 8。<a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=130240&amp;SiteID=1"><u><font color=#0066ff>http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=130240&amp;SiteID=1</font></u></a></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp; 9。<a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=94312&amp;SiteID=1"><u><font color=#0066ff>http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=94312&amp;SiteID=1</font></u></a></div>
<div>&nbsp;&nbsp;&nbsp; 10。<a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=190815&amp;SiteID=1"><u><font color=#0066ff>http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=190815&amp;SiteID=1</font></u></a></div>
<div>&nbsp;&nbsp;&nbsp; 11。<a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=208118&amp;SiteID=1"><u><font color=#0066ff>http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=208118&amp;SiteID=1</font></u></a></div>
<div>&nbsp;&nbsp;&nbsp; 12。<a href="http://forums.microsoft.com/china/ShowPost.aspx?PostID=1988459&amp;SiteID=15"><u><font color=#0066ff>http://forums.microsoft.com/china/ShowPost.aspx?PostID=1988459&amp;SiteID=15</font></u></a><br><br><br><br><br><br>我也碰到上面的问题，上面是解决方案。直接在stdafx.h头文件中加入这个就可以了。#pragma comment(linker, "\"/manifestdependency:type='Win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='X86' publicKeyToken='1fc8b3b9a1e18e3b' language='*'\"")<br></div>
<img src ="http://www.cppblog.com/deercoder/aggbug/101006.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/deercoder/" target="_blank">刘畅</a> 2009-11-15 19:51 <a href="http://www.cppblog.com/deercoder/articles/101006.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>