﻿<?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++博客-Mr.Johnson is Here-随笔分类-学习笔记</title><link>http://www.cppblog.com/koople/category/12240.html</link><description>有时候我会相信一切都会有尽头</description><language>zh-cn</language><lastBuildDate>Sun, 18 Sep 2011 23:53:46 GMT</lastBuildDate><pubDate>Sun, 18 Sep 2011 23:53:46 GMT</pubDate><ttl>60</ttl><item><title>error C2632: 'long' followed by 'long' is illegal</title><link>http://www.cppblog.com/koople/archive/2011/09/05/155148.html</link><dc:creator>Mr.Johnson</dc:creator><author>Mr.Johnson</author><pubDate>Mon, 05 Sep 2011 10:40:00 GMT</pubDate><guid>http://www.cppblog.com/koople/archive/2011/09/05/155148.html</guid><wfw:comment>http://www.cppblog.com/koople/comments/155148.html</wfw:comment><comments>http://www.cppblog.com/koople/archive/2011/09/05/155148.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/koople/comments/commentRss/155148.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/koople/services/trackbacks/155148.html</trackback:ping><description><![CDATA[&nbsp; &nbsp;今天在编译模拟器的时候，移植一段代码，发现怎么都编译不过，总是报c:\program files\microsoft visual studio\vc98\include\windef.h(141) : error C2632: 'long' followed by 'long' is illegal 错误。<br />&nbsp; &nbsp;发现是&nbsp;<span style="font-family: simsun; line-height: 23px; text-align: left; background-color: #ffffff; ">头文件</span><span style="font-family: simsun; line-height: 23px; text-align: left; background-color: #ffffff; ">可能最后少},; #endif 之类的东西。</span><img src ="http://www.cppblog.com/koople/aggbug/155148.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/koople/" target="_blank">Mr.Johnson</a> 2011-09-05 18:40 <a href="http://www.cppblog.com/koople/archive/2011/09/05/155148.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>有关time的函数</title><link>http://www.cppblog.com/koople/archive/2011/02/11/139882.html</link><dc:creator>Mr.Johnson</dc:creator><author>Mr.Johnson</author><pubDate>Fri, 11 Feb 2011 02:00:00 GMT</pubDate><guid>http://www.cppblog.com/koople/archive/2011/02/11/139882.html</guid><wfw:comment>http://www.cppblog.com/koople/comments/139882.html</wfw:comment><comments>http://www.cppblog.com/koople/archive/2011/02/11/139882.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/koople/comments/commentRss/139882.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/koople/services/trackbacks/139882.html</trackback:ping><description><![CDATA[时间日期函数,函数库为time.h<br>在时间日期函数里,主要用到的结构有以下几个:<br>总时间日期贮存结构tm<br>┌──────────────────────┐<br>│struct tm                                   │<br>│{                                           │<br>│ int tm_sec;   /*秒,0-59*/                  │<br>│ int tm_min;   /*分,0-59*/                  │<br>│ int tm_hour;  /*时,0-23*/                  │<br>│ int tm_mday;  /*天数,1-31*/                │<br>│ int tm_mon;   /*月数,0-11*/                │<br>│ int tm_year;  /*自1900的年数*/             │<br>│ int tm_wday;  /*自星期日的天数0-6*/        │<br>│ int tm_yday;  /*自1月1日起的天数,0-365*/   │<br>│ int tm_isdst; /*是否采用夏时制,采用为正数*/│<br>│}                                           │<br>└──────────────────────┘<br>日期贮存结构date<br>┌───────────────┐<br>│struct date                   │<br>│{                             │<br>│ int da_year; /*自1900的年数*/│<br>│ char da_day; /*天数*/        │<br>│ char da_mon; /*月数 1=Jan*/  │<br>│}                             │<br>└───────────────┘<br>时间贮存结构time<br>┌────────────────┐<br>│struct time                     │<br>│{                               │<br>│ unsigned char ti_min;  /*分钟*/│<br>│ unsigned char ti_hour; /*小时*/│<br>│ unsigned char ti_hund;         │<br>│ unsigned char ti_sec;  /*秒*/  │<br>│}                               │<br>└────────────────┘<br>char      *ctime(long *clock)<br> &nbsp;           本函数把clock所指的时间(如由函数time返回的时间)转换成下列格式的<br> &nbsp;           字符串:Mon Nov 21 11:31:54 1983\n\0<br>char      *asctime(struct tm *tm)<br> &nbsp;           本函数把指定的tm结构类的时间转换成下列格式的字符串:<br> &nbsp;           Mon Nov 21 11:31:54 1983\n\0<br>double     difftime(time_t time2,time_t time1)<br> &nbsp;           计算结构time2和time1之间的时间差距(以秒为单位)<br>struct tm *gmtime(long *clock)本函数把clock所指的时间(如由函数time返回的时间)<br> &nbsp;           转换成格林威治时间,并以tm结构形式返回<br>struct tm *localtime(long *clock)本函数把clock所指的时间(如函数time返回的时间)<br> &nbsp;           转换成当地标准时间,并以tm结构形式返回<br>void       tzset()本函数提供了对UNIX操作系统的兼容性<br>long       dostounix(struct date *dateptr,struct time *timeptr)<br> &nbsp;           本函数将dateptr所指的日期,timeptr所指的时间转换成UNIX格式,并返回<br> &nbsp;           自格林威治时间1970年1月1日凌晨起到现在的秒数<br>void       unixtodos(long utime,struct date *dateptr,struct time *timeptr)<br> &nbsp;           本函数将自格林威治时间1970年1月1日凌晨起到现在的秒数utime转换成<br> &nbsp;           DOS格式并保存于用户所指的结构dateptr和timeptr中<br>void       getdate(struct date *dateblk)本函数将计算机内的日期写入结构dateblk<br> &nbsp;           中以供用户使用<br>void       setdate(struct date *dateblk)本函数将计算机内的日期改成<br> &nbsp;           由结构dateblk所指定的日期<br>void       gettime(struct time *timep)本函数将计算机内的时间写入结构timep中,<br> &nbsp;           以供用户使用<br>void       settime(struct time *timep)本函数将计算机内的时间改为<br> &nbsp;           由结构timep所指的时间<br>long       time(long *tloc)本函数给出自格林威治时间1970年1月1日凌晨至现在所经<br> &nbsp;           过的秒数,并将该值存于tloc所指的单元中.<br>int        stime(long *tp)本函数将tp所指的时间(例如由time所返回的时间)<br> &nbsp;           写入计算机中.<img src ="http://www.cppblog.com/koople/aggbug/139882.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/koople/" target="_blank">Mr.Johnson</a> 2011-02-11 10:00 <a href="http://www.cppblog.com/koople/archive/2011/02/11/139882.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>COM应用原理使用VS2005打开遇到的问题</title><link>http://www.cppblog.com/koople/archive/2010/05/26/116339.html</link><dc:creator>Mr.Johnson</dc:creator><author>Mr.Johnson</author><pubDate>Tue, 25 May 2010 21:24:00 GMT</pubDate><guid>http://www.cppblog.com/koople/archive/2010/05/26/116339.html</guid><wfw:comment>http://www.cppblog.com/koople/comments/116339.html</wfw:comment><comments>http://www.cppblog.com/koople/archive/2010/05/26/116339.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/koople/comments/commentRss/116339.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/koople/services/trackbacks/116339.html</trackback:ping><description><![CDATA[<p>今天没事用VS2005打开一个COM应用原理的源代码，一运行就报错，然后修改来修改去，最终有2个主要错误：<br>1. 不能将参数&nbsp; 从&#8220;const wchar_t [ ]&#8221;转换为&#8220;String&#8221;<br></p>
2.无法解析的外部符号 "char * __stdcall _com_util::ConvertBSTRToString(wchar_t *)&#8220;<br><br>第一个问题我发现源码中String被定义为
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">typedef&nbsp;unsigned&nbsp;</span><span style="COLOR: #0000ff">short</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">String;</span></div>
翻阅MSDN里面有段话<br>
<p>By providing overloads for both the <strong>unsigned short</strong> and<strong> __wchar_t</strong> variations of <strong>wchar_t</strong>, you can create libraries that can easily be linked with code compiled with or without <strong>/Zc:wchar_t</strong> and avoid the need to provide two different builds of the library (one with and one without <strong>/Zc:wchar_t</strong> enabled).</p>
意思是要不使用内置的wchar_t类型来避免这两个不同的库冲突<br>第二个问题也是一样的<br>具体原因是你导入的库对于wchar_t不是内置类型，以前的vc6都不是，而vc6.0之后的工程缺省都是wchar_t是内建类型，其导出出来的符号是不一样的。所以，你只需要在vc7的project/proterties里面的c／c++&nbsp;&nbsp; --&gt;language&nbsp;&nbsp;&nbsp;&nbsp; --&gt;treat&nbsp;&nbsp; wchar_t&nbsp;&nbsp; as&nbsp;&nbsp; build_in&nbsp;&nbsp; type设置为no,就可以和以前那些库兼容了。所有使用了wchat_t的函数都会有这个问题。<br>
<img src ="http://www.cppblog.com/koople/aggbug/116339.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/koople/" target="_blank">Mr.Johnson</a> 2010-05-26 05:24 <a href="http://www.cppblog.com/koople/archive/2010/05/26/116339.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>