﻿<?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>IT博客-梦中江湖</title><link>http://www.cnitblog.com/vcleaner/</link><description>世间一切皆为江湖，世间一切皆不为江湖。曾经年少，觉得一切皆是那么美好，世间事物一切皆可为我所有，天下之大皆我可往。有一种江湖的情结，豪情满胸。可是时间的流逝，年龄的增长，心中的江湖已经不在，现在江湖泛滥，唯有小酌入梦后，才能在梦中再见我的江湖！再见我的青春！</description><language>zh-cn</language><lastBuildDate>Mon, 04 May 2026 20:56:30 GMT</lastBuildDate><pubDate>Mon, 04 May 2026 20:56:30 GMT</pubDate><ttl>60</ttl><item><title>MFC对话框程序中添加工具栏及工具栏上的Button响应UPDATE_COMMAND_UI消息</title><link>http://www.cnitblog.com/vcleaner/archive/2005/08/02/1254.html</link><dc:creator>梦中江湖</dc:creator><author>梦中江湖</author><pubDate>Tue, 02 Aug 2005 04:54:00 GMT</pubDate><guid>http://www.cnitblog.com/vcleaner/archive/2005/08/02/1254.html</guid><wfw:comment>http://www.cnitblog.com/vcleaner/comments/1254.html</wfw:comment><comments>http://www.cnitblog.com/vcleaner/archive/2005/08/02/1254.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/vcleaner/comments/commentRss/1254.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/vcleaner/services/trackbacks/1254.html</trackback:ping><description><![CDATA[<P><FONT size=2>对话框中添加工具栏及工具栏上的Button响应UPDATE_COMMAND_UI消息</FONT></P>
<P><FONT size=2>在对话框程序中添加工具栏其实很简单，网上能找到很多的例子。一般的步骤就是：1、在资源中添加工</FONT></P>
<P><FONT size=2>具栏资源；2、在对话框类中定义一个工具栏变量；3、在对话框的OnInitDialog函数中Create工具栏。程</FONT></P>
<P><FONT size=2>序如下：<BR>在对话框类中定义工具栏成员变量：<BR>CToolBar m_ToolBar;<BR>在OnInitDialog函数中Create之：<BR>if(!m_ToolBar.CreateEx(this, TBSTYLE_FLAT, </FONT></P>
<P><FONT size=2>WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER|CBRS_TOOLTIPS|CBRS_SIZE_DYNAMIC)<BR>&nbsp;&nbsp;||!m_ToolBar.LoadToolBar(IDR_TOOLBAR_GRAPHICS))<BR>&nbsp;{<BR>&nbsp;&nbsp;TRACE0(_T("创建工具条失败\n"));<BR>&nbsp;&nbsp;return FALSE;<BR>&nbsp;}<BR>&nbsp;RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);</FONT></P>
<P><FONT size=2>但是要让对话框中的工具栏响应UPDATE_COMMAND_UI消息，做到按下保持的状态仅仅重载</FONT></P>
<P><FONT size=2>UPDATE_COMMAND_UI消息并使用SetCheck是不行的，因为此时的工具栏上的按钮属性为普通的按钮，可以</FONT></P>
<P><FONT size=2>通过下面的方法测试：<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(m_ToolBar.GetButtonStyle(0) == TBBS_BUTTON)<BR>&nbsp;{<BR>&nbsp;&nbsp;AfxMessageBox("This is Button Style");<BR>&nbsp;}<BR>必须添加以下的设置：<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_ToolBar.SetButtonStyle(0,TBBS_CHECKBOX);<BR>&nbsp;m_ToolBar.SetButtonStyle(1,TBBS_CHECKBOX);<BR>SetButtonStyle函数的原型及其相关的说明：（引自MSDN）<BR>1、void SetButtonStyle( int nIndex, UINT nStyle );</FONT></P>
<P><FONT size=2>Parameters</FONT></P>
<P><FONT size=2>nIndex</FONT></P>
<P><FONT size=2>Index of the button or separator whose information is to be set.</FONT></P>
<P><FONT size=2>nStyle</FONT></P>
<P><FONT size=2>The button style. The following button styles are supported: </FONT></P>
<P><FONT size=2>TBBS_BUTTON&nbsp;&nbsp; Standard pushbutton (default)</FONT></P>
<P><BR><FONT size=2>TBBS_SEPARATOR&nbsp;&nbsp; Separator</FONT></P>
<P><BR><FONT size=2>TBBS_CHECKBOX&nbsp;&nbsp; Auto check-box button</FONT></P>
<P><BR><FONT size=2>TBBS_GROUP&nbsp;&nbsp; Marks the start of a group of buttons</FONT></P>
<P><BR><FONT size=2>TBBS_CHECKGROUP&nbsp;&nbsp; Marks the start of a group of check-box buttons <BR>Remarks</FONT></P>
<P><FONT size=2>Call this member function to set the style of a button or separator, or to group buttons. A </FONT></P>
<P><FONT size=2>button's style determines how the button appears and how it responds to user input.</FONT></P>
<P><FONT size=2>2、还有一种修改Button属性的函数<BR>void SetButtonInfo( int nIndex, UINT nID, UINT nStyle, int iImage );</FONT></P>
<P><FONT size=2>Parameters</FONT></P>
<P><FONT size=2>nIndex</FONT></P>
<P><FONT size=2>Index of the button or separator whose information is to be set.</FONT></P>
<P><FONT size=2>nID</FONT></P>
<P><FONT size=2>The value to which the button’s command ID is set.</FONT></P>
<P><FONT size=2>nStyle</FONT></P>
<P><FONT size=2>The new button style. The following button styles are supported: </FONT></P>
<P><FONT size=2>TBBS_BUTTON&nbsp;&nbsp; Standard pushbutton (default)</FONT></P>
<P><BR><FONT size=2>TBBS_SEPARATOR&nbsp;&nbsp; Separator</FONT></P>
<P><BR><FONT size=2>TBBS_CHECKBOX&nbsp;&nbsp; Auto check-box button</FONT></P>
<P><BR><FONT size=2>TBBS_GROUP&nbsp;&nbsp; Marks the start of a group of buttons</FONT></P>
<P><BR><FONT size=2>TBBS_CHECKGROUP&nbsp;&nbsp; Marks the start of a group of check-box buttons <BR>iImage</FONT></P>
<P><FONT size=2>New index for the button’s image within the bitmap.</FONT></P>
<P><FONT size=2>Remarks</FONT></P>
<P><FONT size=2>Call this member function to set the button's command ID, style, and image number. For </FONT></P>
<P><FONT size=2>separators, which have the style TBBS_SEPARATOR, this function sets the separator's width in </FONT></P>
<P><FONT size=2>pixels to the value stored in iImage.</FONT></P>
<P><FONT size=2>For information on bitmap images and buttons, see the CToolBar Overview and </FONT></P>
<P><FONT size=2>CToolBar::LoadBitmap. </FONT></P>
<P><FONT size=2></FONT>&nbsp;</P><img src ="http://www.cnitblog.com/vcleaner/aggbug/1254.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/vcleaner/" target="_blank">梦中江湖</a> 2005-08-02 12:54 <a href="http://www.cnitblog.com/vcleaner/archive/2005/08/02/1254.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VC＋＋的链接错误LNK2001（转） </title><link>http://www.cnitblog.com/vcleaner/archive/2005/08/02/1253.html</link><dc:creator>梦中江湖</dc:creator><author>梦中江湖</author><pubDate>Tue, 02 Aug 2005 04:51:00 GMT</pubDate><guid>http://www.cnitblog.com/vcleaner/archive/2005/08/02/1253.html</guid><wfw:comment>http://www.cnitblog.com/vcleaner/comments/1253.html</wfw:comment><comments>http://www.cnitblog.com/vcleaner/archive/2005/08/02/1253.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/vcleaner/comments/commentRss/1253.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/vcleaner/services/trackbacks/1253.html</trackback:ping><description><![CDATA[<FONT size=2>在VC/MFC社区中经常看到有人问一些编译错误怎么解决的问题，很多错误都是VC＋＋的链接错误LNK2001，所以把这篇我记不得从什么地方获得的文章贴出来，也许对大家有点帮助。在此要感谢本文的原始作者，为他的专业精神！<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 学习VC＋＋时经常会遇到链接错误LNK2001，该错误非常讨厌，因为对于<BR>编程者来说，最好改的错误莫过于编译错误，而一般说来发生连接错误时，<BR>编译都已通过。产生连接错误的原因非常多，尤其LNK2001错误，常常使人不<BR>明其所以然。如果不深入地学习和理解VC＋＋，要想改正连接错误LNK2001非<BR>常困难。<BR>　　初学者在学习VC＋＋的过程中，遇到的LNK2001错误的错误消息主要为：<BR>　　unresolved external symbol “symbol”（不确定的外部“符号”）。<BR>　　如果连接程序不能在所有的库和目标文件内找到所引用的函数、变量或<BR>标签，将产生此错误消息。一般来说，发生错误的原因有两个：一是所引用<BR>的函数、变量不存在、拼写不正确或者使用错误；其次可能使用了不同版本<BR>的连接库。<BR>　　以下是可能产生LNK2001错误的原因：<BR>　　一．由于编码错误导致的LNK2001。<BR>　　1．不相匹配的程序代码或模块定义（.DEF）文件能导致LNK2001。例如, <BR>如果在C＋＋ 源文件内声明了一变量“var1”，却试图在另一文件内以变量<BR>“VAR1”访问该变量,将发生该错误。<BR>　　2．如果使用的内联函数是在.CPP文件内定义的，而不是在头文件内定<BR>义将导致LNK2001错误。<BR>　　3．调用函数时如果所用的参数类型同函数声明时的类型不符将会产生<BR>LNK2001。<BR>　　4．试图从基类的构造函数或析构函数中调用虚拟函数时将会导致LNK2001。<BR>　　5．要注意函数和变量的可公用性，只有全局变量、函数是可公用的。<BR>　　静态函数和静态变量具有相同的使用范围限制。当试图从文件外部访问<BR>任何没有在该文件内声明的静态变量时将导致编译错误或LNK2001。<BR>　　函数内声明的变量（局部变量） 只能在该函数的范围内使用。<BR>　　C＋＋ 的全局常量只有静态连接性能。这不同于C，如果试图在C＋＋的<BR>多个文件内使用全局变量也会产生LNK2001错误。一种解决的方法是需要时在<BR>头文件中加入该常量的初始化代码，并在.CPP文件中包含该头文件；另一种<BR>方法是使用时给该变量赋以常数。<BR>　　二．由于编译和链接的设置而造成的LNK2001<BR>　　1．如果编译时使用的是/NOD（/NODEFAULTLIB）选项，程序所需要的运行<BR>库和MFC库在连接时由编译器写入目标文件模块， 但除非在文件中明确包含<BR>这些库名，否则这些库不会被链接进工程文件。在这种情况下使用/NOD将导<BR>致错误LNK2001。<BR>　　2．如果没有为wWinMainCRTStartup设定程序入口，在使用Unicode和MFC<BR>时将得到“unresolved external on </FONT><A href="mailto:_WinMain@16"><FONT size=2>_WinMain@16</FONT></A><FONT size=2>”的LNK2001错误信息。<BR>　　3．使用/MD选项编译时,既然所有的运行库都被保留在动态链接库之内，<BR>源文件中对“func”的引用，在目标文件里即对“__imp__func” 的引用。<BR>如果试图使用静态库LIBC.LIB或LIBCMT.LIB进行连接，将在__imp__func上发<BR>生LNK2001；如果不使用/MD选项编译，在使用MSVCxx.LIB连接时也会发生LNK2001。<BR>　　4．使用/ML选项编译时，如用LIBCMT.LIB链接会在_errno上发生LNK2001。<BR>　　5．当编译调试版的应用程序时，如果采用发行版模态库进行连接也会产<BR>生LNK2001；同样，使用调试版模态库连接发行版应用程序时也会产生相同的<BR>问题。<BR>　　6．不同版本的库和编译器的混合使用也能产生问题，因为新版的库里可<BR>能包含早先的版本没有的符号和说明。<BR>　　7．在不同的模块使用内联和非内联的编译选项能够导致LNK2001。如果<BR>创建C＋＋库时打开了函数内联（/Ob1或/Ob2），但是在描述该函数的相应头<BR>文件里却关闭了函数内联（没有inline关键字），这时将得到该错误信息。<BR>为避免该问题的发生，应该在相应的头文件中用inline关键字标志内联函数。<BR>　　8．不正确的/SUBSYSTEM或/ENTRY设置也能导致LNK2001。<BR>　　其实，产生LNK2001的原因还有很多，以上的原因只是一部分而已，对初<BR>学者来说这些就够理解一阵子了。但是，分析错误原因的目的是为了避免错<BR>误的发生。LNK2001错误虽然比较困难，但是只要注意到了上述问题，还是能<BR>够避免和予以解决的。　<BR><BR></FONT><img src ="http://www.cnitblog.com/vcleaner/aggbug/1253.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/vcleaner/" target="_blank">梦中江湖</a> 2005-08-02 12:51 <a href="http://www.cnitblog.com/vcleaner/archive/2005/08/02/1253.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>我的程序语录</title><link>http://www.cnitblog.com/vcleaner/archive/2005/07/27/1148.html</link><dc:creator>梦中江湖</dc:creator><author>梦中江湖</author><pubDate>Wed, 27 Jul 2005 05:29:00 GMT</pubDate><guid>http://www.cnitblog.com/vcleaner/archive/2005/07/27/1148.html</guid><wfw:comment>http://www.cnitblog.com/vcleaner/comments/1148.html</wfw:comment><comments>http://www.cnitblog.com/vcleaner/archive/2005/07/27/1148.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/vcleaner/comments/commentRss/1148.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/vcleaner/services/trackbacks/1148.html</trackback:ping><description><![CDATA[<P><FONT color=#ff1493><FONT color=#ff0000>授人以鱼不如授人以渔</FONT><BR></FONT>－－授人以鱼，三餐之需；授人以渔，终生之用。映射我们的编程之路，我们应该知道的更多为什么这么做，而不仅仅只知道可以这么做。要做到知其然，更要知其所以然。在论坛上回答别人的问题时，仅仅贴出代码，虽然也能帮助别人解决一时之需，但是如果让别人知道“所以然”，那就更好了。</P>
<P><FONT color=#ff0000>人一定要靠自己<BR></FONT>－－电影《鼠胆龙威》中的台词。那个医生在说这句话的时候，总是一脸的严肃。在编程的过程中，很多人都在各个论坛上提问，这个我是提倡的，毕竟知识共享带来的是大家共同的进步，但是在提问之前你努力去尝试解决问题了吗？现在很多人在遇到问题以后，第一个念头就是在论坛上提问，自己从来不动脑子，别人告诉他解决的原理时，有的人还不愿意自己动手编码，非要得到直接可用的代码才罢休，从这个角度来说，论坛的存在一定程度上存在着负面效果。其实自己完全独立的去解决编程中的问题，比在别人帮助下解决所给你留下的印象更为深刻，学到的会更多。人的一生要独自面对很多问题，不仅是编程，生活中也会有，学会独立思考，独立解决问题，对一个人的一生可能起到决定命运的效果。人生很多关键的十字路口，如果你没有独立的去思考，独立的解决、抉择，那么就会“一失足成千古恨”。</P>
<P><FONT color=#ff0000>只要有希望就永远不放弃，只要不放弃就永远有希望</FONT><BR>－－我的座右铭。虽然可能听起来有点自欺欺人，有点阿Q。但是个人觉得编程过程中我们可能真的很需要阿Q精神，物质的世界，诱惑太多，现在太多的人浮躁，只有很少的能静下心来认真的学习、研究编程的技术，所以我们需要阿Q精神来“迷惑”自己，抵制诱惑，做到心平气和。同时，这句话也告诉我们编程的路上需要毅力和耐力，每个程序员都可能经历过一个功能，使用自己的方法无法实现的情况，很多人在这时候退却了，他们选择了“旁通”的方法，变相的解决了问题，我不是说这样不好，而是我觉得在完成了领导交给的任务后，我们应该回过头来坚持自己的方法，不管是成功还是失败，我想你必定能有所收获。</P>
<P><FONT color=#ff0000>我没做大哥很久了......<BR></FONT>－－我在CSDN的帐号的昵称，电影《英雄本色》的台词。在说这句话时，剧中人物有种重入江湖的豪情，和对未来的不确定。编程道路上，我们需要这种豪情，它在一定程度上是我们工作的动力，编程世界的种种新奇的技术细节，给了我们不断的激情，编程世界中的种种不确定，也让我们如痴如醉的陷入其中。编程世界何尝不是一种江湖？一个工程，一个程序，一个功能，一个细节，都象一场战斗，当我们解决了它，何尝没有一种如愿复仇、快意江湖的感觉？</P><img src ="http://www.cnitblog.com/vcleaner/aggbug/1148.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/vcleaner/" target="_blank">梦中江湖</a> 2005-07-27 13:29 <a href="http://www.cnitblog.com/vcleaner/archive/2005/07/27/1148.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用Flash彻底美化你的程序</title><link>http://www.cnitblog.com/vcleaner/archive/2005/06/27/572.html</link><dc:creator>梦中江湖</dc:creator><author>梦中江湖</author><pubDate>Mon, 27 Jun 2005 07:46:00 GMT</pubDate><guid>http://www.cnitblog.com/vcleaner/archive/2005/06/27/572.html</guid><wfw:comment>http://www.cnitblog.com/vcleaner/comments/572.html</wfw:comment><comments>http://www.cnitblog.com/vcleaner/archive/2005/06/27/572.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/vcleaner/comments/commentRss/572.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/vcleaner/services/trackbacks/572.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 曾经在VCKbase（VC知识库）网站看到过一篇关于Flash的文章，叫做《在VC中使用 Flash 美化你的程序》，文章中介绍的是使用Flash控件在对话框程序中播放Flash文件。由于以前的工作需要曾经接触过使用Scoket通信在VC的Exe程序和Flash程序中通信的相关技术。在这里介绍给大家。相比上面的那篇文章，其有一下有点：1、&nbsp; 界面上更加优美。所有的界面部分都是直接使用...&nbsp;&nbsp;<a href='http://www.cnitblog.com/vcleaner/archive/2005/06/27/572.html'>阅读全文</a><img src ="http://www.cnitblog.com/vcleaner/aggbug/572.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/vcleaner/" target="_blank">梦中江湖</a> 2005-06-27 15:46 <a href="http://www.cnitblog.com/vcleaner/archive/2005/06/27/572.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>我对COM的理解 </title><link>http://www.cnitblog.com/vcleaner/archive/2005/06/20/460.html</link><dc:creator>梦中江湖</dc:creator><author>梦中江湖</author><pubDate>Mon, 20 Jun 2005 01:10:00 GMT</pubDate><guid>http://www.cnitblog.com/vcleaner/archive/2005/06/20/460.html</guid><wfw:comment>http://www.cnitblog.com/vcleaner/comments/460.html</wfw:comment><comments>http://www.cnitblog.com/vcleaner/archive/2005/06/20/460.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/vcleaner/comments/commentRss/460.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/vcleaner/services/trackbacks/460.html</trackback:ping><description><![CDATA[COM，组件对象模型，通俗说就是COM就是提供了一种编程的架构。通过COM规范规定了COM组件应该实现的一些接口和接口函数，其他程序通过固定的方法使用这些函数，在Windows平台下，所谓的固定方法通过提供的各种GUID在注册表中找到COM组件，然后调用指定的DLL或者EXE(通过ROT)调用指定的函数，以获得所需要的接口的指针，所谓的接口的指针其实就是指向函数指针数组的指针，通过接口指针调用COM组件提供的服务。<BR>&nbsp;&nbsp;&nbsp; 如果不借助ATL等类库等实现COM组件，其实也很简单，只需要牢记下面几点就可以了：<BR>&nbsp;&nbsp;&nbsp; 1、使用IDL在idl文件中定义接口。因为COM是与语言无关的，所以需要一种各种语言等能懂的语言来定义<BR>&nbsp;&nbsp;&nbsp; 接口。使用MIDL编译编写好的idl文件可以获得一个.h文件，从此文件中就可以看出在idl文件中定义的<BR>&nbsp;&nbsp;&nbsp; 接口被编译成了C++中的纯虚类。从这里也可以得到：<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A、纯虚类的内存结构确实是和COM所要求的内存结构相同，所以使用纯虚类来定义COM接口；<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; B、其实可以不需要idl文件直接使用C++语言定义COM接口，那又为什么需要呢?简单言之，就是为了<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 实现COM的语言无关性。使用C++定义的接口不能被其他语言所使用，当使用IDL语言编写的idl文件<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 被MIDL编译之后可以生成一个.tlb的类型库文件，此文件可以被其他语言使用。<BR>&nbsp;&nbsp; &nbsp;2、接口的实现其实很简单，就是在继承了所定义的接口的派生类当中实现就可以了。一个派生类可以继承自多个接口。为了实现一些功能可以继承自一些标准的COM接口，比如：IDispatch、IMarshl等，但是一般都需要实现IClassFactory或者IClassFactory2接口。类厂接口的作用是提供一个通用的创建组件对象的<BR>&nbsp;&nbsp; &nbsp;方法。对于进程内组件在C++中我们可以使用new来创建新的对象，但是对于进程外或者是远程的组件，new&nbsp;好像是无能为力了，所以提供类厂接口，由类厂和代理打交道来完成对象的创建。<BR>&nbsp;&nbsp; &nbsp;3、组件程序中实现相关的导出函数，以便被其他应用程序调用，比如注册函数、生命周期控制函数等等。<BR>&nbsp;&nbsp; &nbsp;4、最后要牢记如果要有不清楚的地方多看MSDN，熟记一些常用的标准接口，对于套间、列集等要特别注意。<BR>&nbsp;&nbsp; &nbsp;<BR>&nbsp;&nbsp; &nbsp;无论是在MFC中使用嵌套类来实现COM，还是ATL中使用的多重继承来实现COM，抑或是使用ODL语言来编写接口的定义，其最基本都是上面所说的，只不过MFC和ATL中多了一些宏来替代直接使用C++编写的各种类定义、函数定义等，这样使程序看起来简洁，但是对于认识COM的原理其实并没有好处，所以在使用这些宏的时候看看它们的定义会帮助你更深刻的认识COM。ODL语言只是IDL语言的扩充，其实没有什么特别的地方，只要多看看，弄懂了一些关键字的意思就可以了，比如：interface、dispinterface、coclass、import、library、importlib、defult等等。<BR>&nbsp;&nbsp;&nbsp; 总之要想深刻的认识COM，熟练的使用COM编程，就要如Don所说，多动手编程，多使用它们，并考虑它们是如何的工作起来的。 <BR><img src ="http://www.cnitblog.com/vcleaner/aggbug/460.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/vcleaner/" target="_blank">梦中江湖</a> 2005-06-20 09:10 <a href="http://www.cnitblog.com/vcleaner/archive/2005/06/20/460.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>调用Windows的Search(搜索)窗口 </title><link>http://www.cnitblog.com/vcleaner/archive/2005/06/20/459.html</link><dc:creator>梦中江湖</dc:creator><author>梦中江湖</author><pubDate>Mon, 20 Jun 2005 01:09:00 GMT</pubDate><guid>http://www.cnitblog.com/vcleaner/archive/2005/06/20/459.html</guid><wfw:comment>http://www.cnitblog.com/vcleaner/comments/459.html</wfw:comment><comments>http://www.cnitblog.com/vcleaner/archive/2005/06/20/459.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/vcleaner/comments/commentRss/459.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/vcleaner/services/trackbacks/459.html</trackback:ping><description><![CDATA[调出windows&nbsp; search&nbsp;&nbsp;&nbsp; <BR>&nbsp;<BR>BOOL&nbsp; SearchFile(CString&nbsp; path)&nbsp; <BR>{&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(path.Right(1).Compare("<A href="file://%22)!=0/">\\")!=0</A>)&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; path+="\\";&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SHELLEXECUTEINFO&nbsp; ss;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ZeroMemory(&amp;ss,sizeof(ss));&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ss.cbSize&nbsp; =&nbsp; sizeof(ss);&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ss.hwnd&nbsp; =&nbsp; GetSafeHwnd();&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ss.nShow&nbsp; =&nbsp; SW_SHOW;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ss.fMask&nbsp;&nbsp;&nbsp; =&nbsp; 0;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ss.lpVerb&nbsp; =&nbsp; _T("find");&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CString&nbsp; sPath=path;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ss.lpFile&nbsp; =&nbsp; (LPCTSTR)sPath;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return&nbsp; ShellExecuteEx(&amp;ss);&nbsp; <BR>}<BR><img src ="http://www.cnitblog.com/vcleaner/aggbug/459.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/vcleaner/" target="_blank">梦中江湖</a> 2005-06-20 09:09 <a href="http://www.cnitblog.com/vcleaner/archive/2005/06/20/459.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CBitmapButton的使用 </title><link>http://www.cnitblog.com/vcleaner/archive/2005/06/20/458.html</link><dc:creator>梦中江湖</dc:creator><author>梦中江湖</author><pubDate>Mon, 20 Jun 2005 01:08:00 GMT</pubDate><guid>http://www.cnitblog.com/vcleaner/archive/2005/06/20/458.html</guid><wfw:comment>http://www.cnitblog.com/vcleaner/comments/458.html</wfw:comment><comments>http://www.cnitblog.com/vcleaner/archive/2005/06/20/458.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cnitblog.com/vcleaner/comments/commentRss/458.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/vcleaner/services/trackbacks/458.html</trackback:ping><description><![CDATA[<P>CBitmapButton的使用<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CBitmapButton作为MFC的控件类，并不为很多人所使用，因为现在网上遍布着从CButton派生的各种各样的按钮类，其中最为著名的就是CButtonST类了。但是最近在CSDN上看到几个问题都是使用CBitmapButton类，但是由于使用错误、不当而造成程序崩溃或者错误的。所以总结一下CBitmapButton类的使用，希望能帮助一些初学者。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 可以参考MSDN自带的例子“CTRLTEST”学习CBitmapButton的用法。个人总结如下：&nbsp; <BR>1、在资源编辑的时候选中按钮的Owner&nbsp; draw即可，不需要选择Bitmap属性！&nbsp; <BR>2、在程序中定义一个CBitmapButton成员变量。不能使用ClassWizard为按钮映射一个CButton变量，然后改为CBitmapButton，这么做并不能将按钮直接映射为CBitmapButton类的对象，反而会出现初始化错误。&nbsp; <BR>3-1、使用CBitmapButton::LoadBitmaps装载各种状态的图片,使用SubclassDlgItem关联到想要的按钮，使用CBitmapButton::SizeToContent函数使按钮适合图片大小。。注意Loadbitmaps一定要在关联到按钮之前进行！&nbsp; <BR>3-2、或者是使用CBitmapButton::AutoLoad函数关联到想要的按钮。需要注意：<BR>A、之前不能使用CBitmapButton::LoadBitmaps装载各种状态的图片，否则会出错。<BR>B、AutoLoad函数完成的关联和改变按钮大小的CBitmapButton::SizeToContent函数的功能。<BR>C、CBitmapButton::AutoLoad使用的位图是默认资源ID的，即它会自动装载相关资源位图。位图的资源ID格式为："按钮Caption+U"、"按钮Caption+D"、"按钮Caption+F"、"按钮Caption+X"，分别代表Up、Down、Focus、Disable状态。如资源编辑时，希望关联的按钮的Caption为Test，那么其默认装载的位图资源的ID为："TestU"/"TestD"/"TestF"/"TestX"，注意分号""也是其ID的一部分。&nbsp; </P>
<P><BR></P><img src ="http://www.cnitblog.com/vcleaner/aggbug/458.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/vcleaner/" target="_blank">梦中江湖</a> 2005-06-20 09:08 <a href="http://www.cnitblog.com/vcleaner/archive/2005/06/20/458.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于浮点数类型和布尔类型的思考 </title><link>http://www.cnitblog.com/vcleaner/archive/2005/06/20/457.html</link><dc:creator>梦中江湖</dc:creator><author>梦中江湖</author><pubDate>Mon, 20 Jun 2005 01:07:00 GMT</pubDate><guid>http://www.cnitblog.com/vcleaner/archive/2005/06/20/457.html</guid><wfw:comment>http://www.cnitblog.com/vcleaner/comments/457.html</wfw:comment><comments>http://www.cnitblog.com/vcleaner/archive/2005/06/20/457.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/vcleaner/comments/commentRss/457.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/vcleaner/services/trackbacks/457.html</trackback:ping><description><![CDATA[<P><FONT size=2>这个问题很多地方都提到了。《高质量C++编程指南》中说了很多了，我也想说一些。<BR>1、关于float和double。记得有一次写一个工控的程序，为了适应数据的大范围，将参数类型选择为double型了。但是测试过程中发现double型的存在误差，如传入的参数为A=1.00000，但是获得的参数值却是A=0.99999999987等这样的数据。后来想到double数据的判断应该使用范围判断，即这么判断：1.00000-Max_Error&lt;A&lt;1.00000+Max_Error,Max_Error是允许的最大误差，其可以将其定义为宏。我要说的问题是：我后来发现float则没有误差。为什么float没有误差呢？至今没有弄明白原因。要说明的是使用double的时候并不是每个数都有误差！有时候是正确的。但是有时候传入的某些值就会有误差。估计和double的内存结构有关！<BR>尽管float没有误差，但是希望以后能养成使用范围比较的习惯。</FONT></P>
<P><FONT color=#ff0000 size=2>/********************************************************************************/</FONT></P>
<P><FONT color=#ff0000 size=2>一般浮点小数是用二进制小数表示的，和整数部分类似，小数也是2的幂次方，只不过幂次是负数而已。 </FONT></P>
<P><FONT color=#ff0000 size=2>例如：0.5(10)表示为0.1(2)，通俗的说，就是2^-1，也就是1/2，同样：0.25(10)表示为0.01(2)，即2^-2，也就是1/4。对于一个定长的小数，例如8位二进制小数，其实际的值就是所有位上的值相加而成，例如： </FONT></P>
<P><FONT color=#ff0000 size=2>0.75(10)=0.11(2)=1/2+1/4 </FONT></P>
<P><FONT color=#ff0000 size=2>因此对于像0.1(10)这样的值需要很多值进行相加，设8位二进制小数，那么 </FONT></P>
<P><FONT color=#ff0000 size=2>0.1(10) 可表示为 0.00011001(2) = 1/16+1/32+1/256 = 0.09765625 </FONT></P>
<P><FONT color=#ff0000 size=2>或者 </FONT></P>
<P><FONT color=#ff0000 size=2>0.1(10) 可表示为 0.00011010(2) = 1/16+1/32+1/128 = 0.1015625 </FONT></P>
<P><FONT color=#ff0000 size=2>由于0.00011001和0.00011010之间已经没有可用的二进制表示了（相对于8位定长二进制小数来说），因此只能用这两个值来代替0.1，具体取那个根据实际的舍入规则确定，由此出现了误差。 </FONT></P>
<P><FONT color=#ff0000 size=2>所以，对于二进制小数来说，只有2的负整数次幂的小数才能够精确表示，否则就可能出现误差。<BR>/**************************************************************************************************/</FONT></P>
<P><FONT size=2>2、BOOL和bool类型。其实在C/C++中BOOL定义为：<BR>typedef int&nbsp;&nbsp;&nbsp;&nbsp; BOOL;<BR>#define FALSE&nbsp;&nbsp; 0<BR>#define TRUE&nbsp;&nbsp;&nbsp; 1<BR>也就是说其实BOOL类型就是int类型，而bool类型则只是有true和false这两个值的一种类型。由于BOOL是int类型的所以，特别的是TRUE在VB中被定义为-1。所以不要在比较的时候将值于TRUE或者1比较，这样比较危险！另外在MFC程序中定义的BOOL类型和bool类型虽然能混用，但是我个人觉得如果是使用MFC编程最好使用BOOL类型的TRUE和FALSE，至少让人觉得风格一致，呵呵！</FONT></P><BR><img src ="http://www.cnitblog.com/vcleaner/aggbug/457.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/vcleaner/" target="_blank">梦中江湖</a> 2005-06-20 09:07 <a href="http://www.cnitblog.com/vcleaner/archive/2005/06/20/457.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>从GetLastError想到的</title><link>http://www.cnitblog.com/vcleaner/archive/2005/06/20/455.html</link><dc:creator>梦中江湖</dc:creator><author>梦中江湖</author><pubDate>Mon, 20 Jun 2005 01:06:00 GMT</pubDate><guid>http://www.cnitblog.com/vcleaner/archive/2005/06/20/455.html</guid><wfw:comment>http://www.cnitblog.com/vcleaner/comments/455.html</wfw:comment><comments>http://www.cnitblog.com/vcleaner/archive/2005/06/20/455.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/vcleaner/comments/commentRss/455.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/vcleaner/services/trackbacks/455.html</trackback:ping><description><![CDATA[<P><FONT size=2>GetLastError是微软提供的一个检测错误的API。<BR>1、原本以为GetLastError是针对进程的，还担心在多线程环境下导致获得错误代码不准确，因为正确执行的代码也可以改变错误代码，但是今天用心看了一下，发现GetLastError是针对线程的，错误代码号码是存储在线程本地存储器中的，即使多线程环境下的线程切换也不会改变它。呵呵，看样子看书还是要认真仔细啊。</FONT></P>
<P><FONT size=2>2、GetLastError能获得错误代码号码，然后使用FormatMessage将其转换为相应的错误信息，这个很好，但是有多少人使用了微软提供的SetLastError呢？我们编写程序的时候，更多的是捕获了异常，然后处理、屏蔽之，虽然可以通过BOOL或者其他类型的函数返回值告诉调用者一些信息。但是一旦不能处理之，我们时候应该告诉调用者，相应的错误信息呢？更不要说是使用微软提供的方案定义自己的错误信息。</FONT></P>
<P><FONT size=2>3、FormatMessage提供的能够通过参数确定显示的错误信息的语种的这种功能又是怎么实现的呢？如果说FormatMessage操作的是WinError.h文件，那么文件中的错误信息好像都是英文的，难道它能有精确的翻译机制？估计应该是OS中也有相关的错误信息的保存的地方。注意MAKELANGID。</FONT></P>
<P><FONT size=2>4、线程的本地存储器机制让我们在使用VC调试器的时候可以在Watch窗口中直接输入"@err,hr"，获得错误代码和错误信息，但是我使用了多少呢？</FONT></P><BR><img src ="http://www.cnitblog.com/vcleaner/aggbug/455.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/vcleaner/" target="_blank">梦中江湖</a> 2005-06-20 09:06 <a href="http://www.cnitblog.com/vcleaner/archive/2005/06/20/455.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>也说Unicode </title><link>http://www.cnitblog.com/vcleaner/archive/2005/06/20/456.html</link><dc:creator>梦中江湖</dc:creator><author>梦中江湖</author><pubDate>Mon, 20 Jun 2005 01:06:00 GMT</pubDate><guid>http://www.cnitblog.com/vcleaner/archive/2005/06/20/456.html</guid><wfw:comment>http://www.cnitblog.com/vcleaner/comments/456.html</wfw:comment><comments>http://www.cnitblog.com/vcleaner/archive/2005/06/20/456.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/vcleaner/comments/commentRss/456.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/vcleaner/services/trackbacks/456.html</trackback:ping><description><![CDATA[<P><FONT size=2>Unicode的出现是为了适应软件国际化的需要。Unicode不同于双字节字符集（DBCS）。<BR><FONT color=#ff0000>一、相关操作函数</FONT><BR>1、DBCS使用下面的函数操作字符串：<BR>CharNext——获得后一个字符<BR>CharPrev——获得前一个字符<BR>IsDBCSLeadByte——判断是否为两个字节字符的第一个字节<BR>C++运行期库提供了以"_mbs"开头的一系列的函数操作DBCS。类似的函数有_mbscat等。</FONT></P>
<P><FONT size=2>2、ANSI字符集是一个美国标准。C++运行期库提供了以"str"开头的一些列的函数操作此字符集。</FONT></P>
<P><FONT size=2>3、C++运行期库为Unicode字符集提供了一系列以"wcs"开头的函数。</FONT></P>
<P><FONT size=2><FONT color=#ff0000>二、对应的数据类型<BR></FONT>1、对于ANSI字符定义为char。<BR>2、对于Unicode的字符定义为wchar_t。</FONT></P>
<P><FONT size=2><FONT color=#ff0000>三、使用环境<BR></FONT>1、首先要说明的是Win98对于Unicode的支持是很微弱的，所以如果要在Win98上运行Unicode编译的程序，可能造成运行错误或者失败。</FONT></P>
<P><FONT size=2>2、由于Win2000及以后的OS的内核都是使用Unicode编写的，所以虽然可以在其上运行ANSI编码的程序，但是其运行过程中很多地方都需要将ANSI转换为Unicode以后，调用Unicode版本的函数，因为这个转换的过程存在所以ANSI的程序运行效率不高。在Win2000上最好使用Unicode编写程序。</FONT></P>
<P><FONT size=2><FONT color=#ff0000>四、编写通用的程序</FONT><BR>1、在编程的时候使用TCHAR数据类型，此类型能够根据预编译宏的定义，将其转换为ANSI或者是Unicode。</FONT></P>
<P><FONT size=2>2、预编译宏_MBCS、_UNICODE和UNICODE。_MBCS是多字节和ANSI字符串的编译宏。此时TCHAR将转换为char。_UNICODE和UNICODE是Unicode编码的预编译宏，TCHAR将转换为wchar_t。</FONT></P>
<P><FONT size=2>3、_UNICODE和UNICODE与_MBCS不能在编译的时候同时被定义。</FONT></P>
<P><FONT size=2>4、_UNICODE宏用于C运行期库的头文件，UNICODE宏用于Windows头文件。一般同时定义这两个宏。</FONT></P>
<P><FONT size=2><FONT color=#ff0000>五、转换函数</FONT><BR>1、Unicode转换为ANSI使用：MultiByteToWideChar。<BR>2、ANSI转换为Unicode使用：WideCharToMultiByte。</FONT></P><img src ="http://www.cnitblog.com/vcleaner/aggbug/456.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/vcleaner/" target="_blank">梦中江湖</a> 2005-06-20 09:06 <a href="http://www.cnitblog.com/vcleaner/archive/2005/06/20/456.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>程序员调试能力和相关书籍 </title><link>http://www.cnitblog.com/vcleaner/archive/2005/06/20/454.html</link><dc:creator>梦中江湖</dc:creator><author>梦中江湖</author><pubDate>Mon, 20 Jun 2005 01:05:00 GMT</pubDate><guid>http://www.cnitblog.com/vcleaner/archive/2005/06/20/454.html</guid><wfw:comment>http://www.cnitblog.com/vcleaner/comments/454.html</wfw:comment><comments>http://www.cnitblog.com/vcleaner/archive/2005/06/20/454.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/vcleaner/comments/commentRss/454.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/vcleaner/services/trackbacks/454.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><FONT size=2><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在软件行业中，个人觉得每个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Coder</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Leader</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（那些当了</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Leader</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">以后就不需要</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Code</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的除外）都应该除了具有良好的编码能力以外，最为主要的就是</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的能力要坚实。千万不要告诉我</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">工作是</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Tester</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">QA</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的事情，首先你要认识到</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的能力是一个并不简单的能力，能帮助你提高你的开发能力，加快开发速度，节约开发成本；其次你更应该知道，你所掌握的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的能力和技术并不可能抢去</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Tester</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或者</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">QA</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的饭碗，他们做的工作更仔细、全面，更富有创造力。由于本人数年来一直使用</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">VC6</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，所以下面使用的观点和相关的描述都是从</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">VC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">出发的，肯定有所偏颇、错误之处，还望各位看官不吝啬地指出，本人定虚心接受，共同讨论，共同学习，共同进步。个人觉得</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">能力包括以下三个个方面：</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=2></FONT><SPAN lang=EN-US>
<P><FONT face="Times New Roman" size=2></FONT>&nbsp;</P></SPAN>
<P><FONT size=2></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=2><SPAN lang=EN-US><FONT face="Times New Roman">1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、良好的编码习惯，良好的逻辑结构能力，对</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的预见能力。一个成熟的程序员，应该有一个良好的编程习惯，不仅需要有良好的编码格式规范，更为需要的是对于程序中的逻辑实现时候有一种良好的结构。编程其实就是数据和逻辑的集合，数据的处理较为简单，或者说是需要的逻辑思维能力比较少，当算法逻辑要在数据上实现的时候，同一种逻辑，让不同的程序员来实现可能有各种各样的不同实现结构，从这个角度来说，这里所说的“良好的编码习惯”就应该指的是对于逻辑实现时候使用的良好的编程结构，一个好的编程结构应该是能预防错误的发生，对错误的预见和错误出现以后的错误处理与异常处理的良好安排。也许有人说这不好办吗？每个逻辑判断的地方添加条件判断或者异常处理不就行了？个人觉得不是那么回事，过多的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">if</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">assert</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">ASSERT</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等语句或者是宏，尤其是并列的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">if</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">语句需要耗费很多判断、执行的时间，对于一个子程序（函数），尤其是调用频率比较频繁的子程序（函数），一次浪费了一点点时间，多次、频繁地调用浪费的时候就显得可观了，所以并不是</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">if</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">语句使用的多，程序出错的可能性就小，过犹不及！如果确实需要使用多个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">if</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">语句进行条件判断，最好能使用嵌套的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">if</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">语句，逐步的缩小判断范围，这样消耗的时间要比并列的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">if</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">语句要小，还要注意的是</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">if</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">语句的条件判断也不是万能的；</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">assert</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">ASSERT</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等判断宏也不是万能的，它会造成</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Release</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">版本在响应速度和最终的编译结果的不同，对于一些关注于性能、响应速度的程序，所造成的影响是不可忽视的。不过开发过程中的调试阶段倒是提倡使用这些宏来发现算法错误和不足。另外对于异常处理段的使用，个人觉得能不用异常处理的地方尽量不要使用异常处理，除非当某个错误发生以后导致程序不能继续执行或者是崩溃的时候才使用异常，有时候你能使用异常处理，将发生错误的程序继续执行下去，但是可能产生的最后结果并不是客户所需要或者是期望的，这样就容易让客户产生质疑：你是不是在程序中做了什么手脚？这也让你失去了获得</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">发生的前提状况信息，从而失去了一次修改</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的机会，所以说有时候当程序发生错误时，仅仅弹出一个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">MessageBox</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提示一些信息，然后关闭程序，也不失为一个好的办法。</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=2></FONT><SPAN lang=EN-US>
<P><FONT face="Times New Roman" size=2></FONT>&nbsp;</P></SPAN>
<P><FONT size=2></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=2><SPAN lang=EN-US><FONT face="Times New Roman">2</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、编码过程中的调试跟踪和错误定位能力。这个能力主要就是在开发过程中，当自己在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Build</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程序，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Run</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">起来以后，竟然发生了</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或者是</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Memory Leak</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，这时候就需要你使用各种工具进行调试跟踪了。首先你要相信</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">VC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">不仅是一个很好的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">IDE</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，也是一个很好的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">工具，其提供的调用栈、条件断点、数据断点、反汇编等工具足够强大，足够应付平常的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，但是现在很多的程序员，包括一些自称为老程序员的也未必能很好的使用这些工具，尤其是条件断点和数据断点（在下面介绍的第二本书中有详细的使用说明）。当</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">VC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">不能满足你的要求的时候你就需要使用其他的工具了，例如：</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SmartChecker</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">BoundChecker</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Purify</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SoftICE</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等等了。从这个角度来说，这里的“调试跟踪能力”不仅是程序员对</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的定位能力，更为主要的还是对于调试工具的掌握、使用的能力。“磨刀不误砍柴工”，在开发之前或者开发闲暇时，好好的研究一下一些开发、调试工具不愧为一种好的提升这种能力的好办法。能静下心来思考一下这些工具的工作原理就更好了，这样不仅能帮助你在编程的时候预见</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，并且对你提高你的编程技巧也会有所帮助。例如</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">VC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的程序在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模式下为什么能发现数组访问越界？这是因为在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模式下，在分配数组所占用的内存时候，编译器在数组内存的两端分别加入了一个字节的越界判断内存。这也就是为什么很多的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">MFC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程序在使用自定义消息的时候在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模式下没有错误而在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Release</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模式下发生错误的原因了。这里我还想说一说我最喜欢做的两种调试方法：当</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">出现的时候，首先确定</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的位置，然后：</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">A</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、注释掉可能导致</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的段落，在需要取得数据值的地方直接提供一个合理的值，然后看看程序是否能正确运行，如此循环往复，逐步缩小范围，最终找出</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所在；</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">B</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、如果</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">被定位在一个小的功能、子程序或者函数中，可以使用新建一个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Test</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">工程，在一个完全“干净”的环境下，对此功能、子程序或者函数进行测试，找出</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所在。此节最后我想说的就是利用你的网络。当一个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">出现时，你也许感到茫然，也许感到无从下手，这时候你就可以利用的你网络资源，使用强大的搜索引擎（比如</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Google</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Baidu</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等等），输入相关的错误提示信息，也许搜索到类似问题的网页，也许别人也遇到过同样或者同类的问题，其他人所提供的答案就是你所需要的，或者能给你以提示、启发的！</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=2></FONT><SPAN lang=EN-US>
<P><FONT face="Times New Roman" size=2></FONT>&nbsp;</P></SPAN>
<P><FONT size=2></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=2><SPAN lang=EN-US><FONT face="Times New Roman">3</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、对事后发生的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">能有良好的感知能力。当一个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">出现的时候，优秀的程序员能根据</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">发生的前提和</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">发生的时间点、程序中的位置，很好的感知到</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可能发生在哪一个函数或者哪几个函数中，是什么情况导致</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的出现的，并且能够很快的定位错误并</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Fix</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这个错误。这种能力使用的地方往往是程序已经</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Release</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">了，已经被客户使用了，在使用的过程中发生了</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，客户向你“倾诉”时。那么怎么才能有这样的能力呢？也许很多的这种能力都是在你不断的摔倒，被经理</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">P</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">了</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">N</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">次以后，所积累起来的经验，所以说这也是一种痛苦以后所获得的快乐的能力，它需要你对自己所做的软件产品的结构、运行条件、运行原理和相关的涉及部分有很好的理解、掌握。有的时候多在网站上看看别人的经历也能有所收获。</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=2></FONT><SPAN lang=EN-US>
<P><FONT face="Times New Roman" size=2></FONT>&nbsp;</P></SPAN>
<P><FONT size=2></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT size=2>在以上的三种能力中，第一种能力主要在于态度和思维能力，后两种则偏向于学习能力和经验的积累；个人觉得第一种最为重要，所谓的“态度决定一切”嘛，呵呵。</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><FONT size=2></FONT><SPAN lang=EN-US>
<P><FONT face="Times New Roman" size=2></FONT>&nbsp;</P></SPAN>
<P><FONT size=2></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT size=2>最后向你推荐几本关于调试的书籍：</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=2></FONT><SPAN lang=EN-US>
<P><FONT face="Times New Roman" size=2></FONT>&nbsp;</P></SPAN>
<P><FONT size=2></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=2><SPAN lang=EN-US><FONT face="Times New Roman">1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、《</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Writing Clean Code</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">——</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Microsoft Techniques for Developing Bug-free C Programs</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">》（中文版译作《编程精粹——</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Microsoft</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">编写优质无错</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">C</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程序秘诀》或者叫做《零错误程序》）——这是一本出版很早的书，现在也许在书店中都看不到了，但是你要相信此书的作者</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Steve Maguire</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（曾是</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Microsoft</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">资深的程序员，参加了</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Excel</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在多个平台下的开发和移植工作）所提供的许多防错、排错、测试的准则还是能让人从中获益非浅的。作者将每章的要点都和自己实际工作经历相结合，提供了翔实的例子和相关代码，使用的语言更是幽默风趣，让人读起来不会感觉晦涩难懂，尤其是每章结束部分提供的练习和思考题更是贴合实际，发人深省。也就是这些原因才使得这本书经久不衰，一直为广大程序所喜爱，所广泛地讨论。至今尚未能见到能与之相媲美的书籍。网上所流传的林锐博士所著的《高质量</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">C++</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">编程指南》和<SPAN style="LETTER-SPACING: 1pt">《软件工程思想》在深度和广度上与之相比也显得逊色不少！</SPAN></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=2></FONT><SPAN lang=EN-US>
<P><FONT face="Times New Roman" size=2></FONT>&nbsp;</P></SPAN>
<P><FONT size=2></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=2><SPAN lang=EN-US><FONT face="Times New Roman">2</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、《</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debugging Windows Programs</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">》（中文版译作《</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Windows</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程序调试》，中国电力出版社出版）——这是一本现在在书店很为流行的一本书。此书使用的语言比较朴实、易懂，也许是译者精心处理的结果，叙述习惯比较符合国人口味。这本书主要包含调试策略、调试工具、调试技术三部分，本书主要介绍的是在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">VC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">IDE</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、编译器下开发程序所应有的一些技术。看完此书你肯定会更为深入的了解</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">MFC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，了解结构化异常和</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">C++</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">异常的区别和联系，了解怎么调试多线程程序，怎么调试</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">COM</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程序，怎么调试内存，怎么调试绘图程序等等。不管你是自认为有多年的开发经验的开发高手，还是刚刚入门的初学者，相信只要你耐心的看完此书，你一定会和我一样深深的感叹一句：原来</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">VC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的调试功能这么强大！如果早点看到这本书就好了！</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=2></FONT><SPAN lang=EN-US>
<P><FONT face="Times New Roman" size=2></FONT>&nbsp;</P></SPAN>
<P><FONT size=2></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=2><SPAN lang=EN-US><FONT face="Times New Roman">3</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、《</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debugging Applications</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">》（本人尚未见到中文版）——这本书主要介绍的是</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">VC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">VB</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的调试，其中</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">VC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的调试占到</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">70%-80%</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">左右。本书也分为三部分：</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的形式，强有力的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的工具和技术。其中有部分内容和上一本书所说的相同。但是这本书还是提供了很多新的东西：介绍了远程调试，提供了一些新的工具使用例子的说明，介绍了更多的底层的东西，甚至涉及汇编的相关信息的阅读和理解。在阅读了上一本书以后，如果你还想提高，这本书是你不错的选择。</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=2></FONT><SPAN lang=EN-US>
<P><FONT face="Times New Roman" size=2></FONT>&nbsp;</P></SPAN>
<P><FONT size=2></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><FONT size=2><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第一本书主要就是培养大家第一种</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">能力的，后两本书是培养大家第二种</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Debug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">能力的，对于第三种能力主要还是要靠经验的积累。</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><FONT size=2></FONT><SPAN lang=EN-US>
<P><FONT face="Times New Roman" size=2></FONT>&nbsp;</P></SPAN>
<P><FONT size=2></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><FONT size=2><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我现在就看到这三本书是比较好的书，如果你觉得有其他的比较好的相关书籍或者相关信息请告知我。在肯定这几本书对你的开发过程会有所帮助的前提下，另外我想说的就是即使你看了这几本书你也不会编写出完全没有</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的程序，毕竟</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Bug</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的种类和发生的情况实在是有很多的客观和主观因素，不可能完全杜绝。程序设计是一门实践性很强的工作，唯有在工作、实践过程中总结教训，总结经验才能不断提高。祝大家在获得知识，积累经验的过程中少走弯路，大踏步的前进！！！</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=2></FONT><SPAN lang=EN-US>
<P><FONT face="Times New Roman" size=2></FONT>&nbsp;</P></SPAN>
<P><FONT size=2></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#ff0000><FONT size=2><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（本文版权归作者所有，如需转载请注明作者和出处，否则也可以转载，但千万不要标注为你个人的作品，否则产生的一切后果请自负，尤其是被</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">BS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、被扔臭鸡蛋的时候，千万不要怨恨我，同时作者我还保留</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">BS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">你的权利，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">^_^</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）</SPAN></FONT></FONT></P><img src ="http://www.cnitblog.com/vcleaner/aggbug/454.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/vcleaner/" target="_blank">梦中江湖</a> 2005-06-20 09:05 <a href="http://www.cnitblog.com/vcleaner/archive/2005/06/20/454.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VC++的链接错误LNK2005</title><link>http://www.cnitblog.com/vcleaner/archive/2005/05/25/203.html</link><dc:creator>梦中江湖</dc:creator><author>梦中江湖</author><pubDate>Wed, 25 May 2005 02:36:00 GMT</pubDate><guid>http://www.cnitblog.com/vcleaner/archive/2005/05/25/203.html</guid><wfw:comment>http://www.cnitblog.com/vcleaner/comments/203.html</wfw:comment><comments>http://www.cnitblog.com/vcleaner/archive/2005/05/25/203.html#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://www.cnitblog.com/vcleaner/comments/commentRss/203.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/vcleaner/services/trackbacks/203.html</trackback:ping><description><![CDATA[<FONT face=Arial><FONT size=2>编程中经常能遇到<SPAN lang=EN-US>LNK2005</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">错误——重复定义错误，其实</SPAN><SPAN lang=EN-US>LNK2005</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">错误并不是一个很难解决的错误。弄清楚它形成的原因，就可以轻松解决它了。</SPAN></FONT></FONT> 
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt"><FONT face=Arial><FONT size=2><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>造成</SPAN><SPAN lang=EN-US>LNK2005</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>错误主要有以下几种情况：</SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 39.0pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="mso-fareast-font-family: " Roman?? New Times><SPAN style="mso-list: Ignore">1．<SPAN style="FONT-WEIGHT: normal; FONT-SIZE: 7pt; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT: normal" Roman?? New Times>&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>重复定义全局变量。可能存在两种情况：</SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 79.5pt; TEXT-INDENT: -37.5pt; mso-list: l0 level2 lfo1; tab-stops: list 79.5pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="mso-fareast-font-family: " Roman?? New Times><SPAN style="mso-list: Ignore">A、<SPAN style="FONT-WEIGHT: normal; FONT-SIZE: 7pt; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT: normal" Roman?? New Times>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>对于一些初学编程的程序员，有时候会以为需要使用全局变量的地方就可以使用定义申明一下。其实这是错误的，全局变量是针对整个工程的。正确的应该是在一个</SPAN><SPAN lang=EN-US>CPP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>文件中定义如下：</SPAN><SPAN lang=EN-US>int g_Test;</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>那么在使用的</SPAN><SPAN lang=EN-US>CPP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>文件中就应该使用：</SPAN><SPAN lang=EN-US>extern int g_Test</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>即可，如果还是使用</SPAN><SPAN lang=EN-US>int g_Test</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>，那么就会产生</SPAN><SPAN lang=EN-US>LNK2005</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>错误，一般错误错误信息类似：</SPAN><SPAN lang=EN-US>AAA.obj error LNK2005 int book c</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>？</SPAN><SPAN lang=EN-US>book@@<CHMETCNV unitname="ha" sourcevalue="3" hasspace="False" negative="False" numbertype="1" tcsc="0" w:st="on">3HA</CHMETCNV> already defined in BBB.obj</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>。切记的就是不能给变量赋值否则还是会有</SPAN><SPAN lang=EN-US>LNK2005</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>错误。</SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 84pt; TEXT-INDENT: -42pt; mso-para-margin-left: 4.0gd; mso-char-indent-count: -4.0"><FONT face=Arial><FONT size=2><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>这里需要的是“声明”，不是“定义”！根据</SPAN><SPAN lang=EN-US>C++</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>标准的规定，一个变量是声明，必须同时满足两个条件，否则就是定义：</SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 42pt; mso-para-margin-left: 4.0gd; mso-char-indent-count: 4.0"><FONT face=Arial><FONT size=2><SPAN lang=EN-US>(1)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>声明必须使用</SPAN><SPAN lang=EN-US>extern</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>关键字；</SPAN><SPAN lang=EN-US>(2)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>不能给变量赋初值</SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 42pt; mso-para-margin-left: 4.0gd; mso-char-indent-count: 4.0"><FONT face=Arial><FONT size=2><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>所以，下面的是声明</SPAN><SPAN lang=EN-US>:</SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 42pt; mso-para-margin-left: 4.0gd; mso-char-indent-count: 4.0"><SPAN lang=EN-US><FONT face=Arial size=2>extern int a;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 42pt; mso-para-margin-left: 4.0gd; mso-char-indent-count: 4.0"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times><FONT face=Arial size=2>下面的是定义</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 42pt; mso-para-margin-left: 4.0gd; mso-char-indent-count: 4.0"><SPAN lang=EN-US><FONT face=Arial size=2>int a; int a = 0; extern int a =0;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US>B</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>、对于那么编程不是那么严谨的程序员，总是在需要使用变量的文件中随意定义一个全局变量，并且对于变量名也不予考虑，这也往往容易造成变量名重复，而造成</SPAN><SPAN lang=EN-US>LNK2005</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>错误。</SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt"><FONT face=Arial size=2></FONT><SPAN lang=EN-US>
<P><FONT face=Arial size=2></FONT>&nbsp;</P></SPAN>
<P><FONT face=Arial size=2></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 39.0pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="mso-fareast-font-family: " Roman?? New Times><SPAN style="mso-list: Ignore">2．<SPAN style="FONT-WEIGHT: normal; FONT-SIZE: 7pt; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT: normal" Roman?? New Times>&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>头文件的包含重复。往往需要包含的头文件中含有变量、函数、类的定义，在其它使用的地方又不得不多次包含之，如果头文件中没有相关的宏等防止重复链接的措施，那么就会产生</SPAN><SPAN lang=EN-US>LNK2005</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>错误。解决办法是在需要包含的头文件中做类似的处理：</SPAN><SPAN lang=EN-US style="COLOR: blue">#ifndef MY_H_FILE</SPAN><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: red">//</SPAN></SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>如果没有定义这个宏</SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="COLOR: blue">#define MY_H_FILE</SPAN><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: red">//</SPAN></SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>定义这个宏</SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt"><FONT face=Arial><FONT size=2><B><SPAN lang=EN-US style="COLOR: blue">…….</SPAN></B><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: red">//</SPAN></SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>头文件主体内容</SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt"><B><SPAN lang=EN-US style="COLOR: blue"><FONT face=Arial size=2>……. </FONT>
<P><FONT face=Arial size=2></FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt"><SPAN lang=EN-US style="COLOR: blue"><FONT face=Arial size=2>#endif </FONT>
<P><FONT face=Arial size=2></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt"><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times><FONT face=Arial size=2>上面是使用宏来做的，也可以使用预编译来做，在头文件中加入：</FONT></SPAN><SPAN lang=EN-US style="COLOR: black"><FONT face=Arial size=2> </FONT>
<P><FONT face=Arial size=2></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt"><SPAN lang=EN-US style="COLOR: blue"><FONT face=Arial size=2>#pragma once </FONT>
<P><FONT face=Arial size=2></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="COLOR: red">//</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>头文件主体</SPAN></FONT></FONT><SPAN lang=EN-US style="COLOR: red"><FONT face=Arial size=2> </FONT>
<P><FONT face=Arial size=2></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 39.0pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="COLOR: black; mso-fareast-font-family: " Roman?? New Times><SPAN style="mso-list: Ignore">3．<SPAN style="FONT-WEIGHT: normal; FONT-SIZE: 7pt; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT: normal" Roman?? New Times>&nbsp; </SPAN></SPAN></SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>使用第三方的库造成的。这种情况主要是</SPAN><SPAN lang=EN-US style="COLOR: black">C</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>运行期函数库和</SPAN><SPAN lang=EN-US style="COLOR: black">MFC</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>的库冲突造成的。具体的办法就是将那个提示出错的库放到另外一个库的前面。另外选择不同的</SPAN><SPAN lang=EN-US style="COLOR: black">C</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>函数库，可能会引起这个错误。微软和</SPAN><SPAN lang=EN-US style="COLOR: black">C</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>有两种</SPAN><SPAN lang=EN-US style="COLOR: black">C</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>运行期函数库，一种是普通的函数库：</SPAN><SPAN lang=EN-US style="COLOR: black">LIBC.LIB</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>，不支持多线程。另外一种是支持多线程的：</SPAN><SPAN lang=EN-US style="COLOR: black">msvcrt.lib</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>。如果一个工程里，这两种函数库混合使用，可能会引起这个错误，一般情况下它需要</SPAN><SPAN lang=EN-US style="COLOR: black">MFC</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>的库先于</SPAN><SPAN lang=EN-US style="COLOR: black">C</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>运行期函数库被链接，因此建议使用支持多线程的</SPAN><SPAN lang=EN-US style="COLOR: black">msvcrt.lib</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>。所以在使用第三方的库之前首先要知道它链接的是什么库，否则就可能造成</SPAN><SPAN lang=EN-US style="COLOR: black">LNK2005</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>错误。如果不得不使用第三方的库，可以尝试按下面所说的方法修改，但不能保证一定能解决问题，前两种方法是微软提供的：</SPAN></FONT></FONT><SPAN lang=EN-US style="COLOR: black"><FONT face=Arial size=2> </FONT>
<P><FONT face=Arial size=2></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 79.5pt; TEXT-INDENT: -37.5pt; mso-list: l0 level2 lfo1; tab-stops: list 79.5pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="COLOR: black; mso-fareast-font-family: " Roman?? New Times><SPAN style="mso-list: Ignore">A、<SPAN style="FONT-WEIGHT: normal; FONT-SIZE: 7pt; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT: normal" Roman?? New Times>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>选择</SPAN><SPAN lang=EN-US style="COLOR: black">VC</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>菜单</SPAN><B><SPAN lang=EN-US style="COLOR: black">Project-&gt;Settings-&gt;Link-&gt;Catagory</SPAN></B><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>选择</SPAN><B><SPAN lang=EN-US style="COLOR: black">Input</SPAN></B><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>，再在</SPAN><STRONG><SPAN lang=EN-US>Ignore libraries</SPAN></STRONG><STRONG><SPAN lang=EN-US style="FONT-WEIGHT: normal"> </SPAN></STRONG><STRONG><SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>的</SPAN></STRONG><STRONG><SPAN lang=EN-US style="FONT-WEIGHT: normal">Edit</SPAN></STRONG><STRONG><SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>栏中填入你需要忽略的库，如：</SPAN></STRONG><SPAN lang=EN-US>Nafxcwd.lib;Libcmtd.lib</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>。然后在</SPAN><STRONG><SPAN lang=EN-US>Object/library Modules</SPAN></STRONG><STRONG><SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>的</SPAN></STRONG><SPAN lang=EN-US style="COLOR: black">Edit</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>栏中填入正确的库的顺序，这里需要你能确定什么是正确的顺序，呵呵，</SPAN><SPAN lang=EN-US style="COLOR: black">God bless you</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>！</SPAN></FONT></FONT><SPAN lang=EN-US style="COLOR: black"><FONT face=Arial size=2> </FONT>
<P><FONT face=Arial size=2></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 79.5pt; TEXT-INDENT: -37.5pt; mso-list: l0 level2 lfo1; tab-stops: list 79.5pt"><FONT face=Arial><FONT size=2><SPAN class=userinput2><B><SPAN lang=EN-US style="COLOR: black; mso-fareast-font-family: " Roman?? New Times><SPAN style="mso-list: Ignore">B、<SPAN style="FONT-WEIGHT: normal; FONT-SIZE: 7pt; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT: normal" Roman?? New Times>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN></B></SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>选择</SPAN><SPAN lang=EN-US style="COLOR: black">VC</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>菜单</SPAN><B><SPAN lang=EN-US style="COLOR: black">Project-&gt;Settings-&gt;Link</SPAN></B><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>页，然后在</SPAN><STRONG><SPAN lang=EN-US>Project Options</SPAN></STRONG><STRONG><SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>的</SPAN></STRONG><STRONG><SPAN lang=EN-US style="FONT-WEIGHT: normal">Edit</SPAN></STRONG><STRONG><SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>栏中输入</SPAN></STRONG><SPAN class=userinput2><B><SPAN lang=EN-US>/verbose:lib</SPAN></B></SPAN></FONT></FONT><SPAN class=userinput2><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times><FONT face=Arial size=2>，这样就可以在编译链接程序过程中在输出窗口看到链接的顺序了。</FONT></SPAN><B><SPAN lang=EN-US style="COLOR: black"><FONT face=Arial size=2> </FONT>
<P><FONT face=Arial size=2></FONT></SPAN></B></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 79.5pt; TEXT-INDENT: -37.5pt; mso-list: l0 level2 lfo1; tab-stops: list 79.5pt"><FONT face=Arial><FONT size=2><SPAN lang=EN-US style="COLOR: black; mso-fareast-font-family: " Roman?? New Times><SPAN style="mso-list: Ignore">C、<SPAN style="FONT-WEIGHT: normal; FONT-SIZE: 7pt; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT: normal" Roman?? New Times>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>选择</SPAN><SPAN lang=EN-US>VC</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>菜单</SPAN><B><SPAN lang=EN-US>Project-&gt;Settings-&gt;C/C++</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>页，</SPAN><B><SPAN lang=EN-US>Catagory</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>选择</SPAN><B><SPAN lang=EN-US>Code Generation</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>后再在</SPAN><B><SPAN lang=EN-US>User Runtime libraray</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>中选择</SPAN><B><SPAN lang=EN-US>MultiThread DLL</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>等其他库，逐一尝试。</SPAN></FONT></FONT><SPAN lang=EN-US style="COLOR: black"><FONT face=Arial size=2> </FONT>
<P><FONT face=Arial size=2></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><FONT face=Arial><FONT size=2><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>这就是我所遇到过的</SPAN><SPAN lang=EN-US>LNK2005</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>错误的几种情况，肯定还有其他的情况也可能造成这种错误，所以我不希望你在看完这篇文章以后，再遇到</SPAN><SPAN lang=EN-US>LNK2005</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>错误时候，不动脑筋的想对号入座的排除错误。编程的过程就是一个思考的过程，所以还是多多开动你的头脑，那样收获会更多！</SPAN></FONT></FONT></P><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#ff0000><FONT face=Arial><FONT size=2><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>（本文版权归作者所有，如需转载请注明作者和出处，否则也可以转载，但千万不要标注为你个人的作品，否则产生的一切后果请自负，尤其是被</SPAN><SPAN lang=EN-US>BS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>、被扔臭鸡蛋的时候，千万不要怨恨我，同时作者我还保留</SPAN><SPAN lang=EN-US>BS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>你的权利，</SPAN><SPAN lang=EN-US>^_^</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: " Roman?? New ?Times mso-hansi-font-family: Roman?; Times>）</SPAN></FONT></FONT></FONT></P></SPAN><img src ="http://www.cnitblog.com/vcleaner/aggbug/203.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/vcleaner/" target="_blank">梦中江湖</a> 2005-05-25 10:36 <a href="http://www.cnitblog.com/vcleaner/archive/2005/05/25/203.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>