日期函数编译问题 [英] Date Functions compile issues

查看:94
本文介绍了日期函数编译问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Richard,你好,

我正在尝试在SimpleDate.cpp&中使用您的日期函数. Parseit.cpp

尝试编译它们-SimpleDate.cpp中的三个主要错误

我已经附上了给出错误的代码行.如果您有时间看一眼,它将非常有帮助.

祝一切顺利




运算符int(){return atoi(TheData);};

错误消息:

Hi Richard,

I''m trying to use your date functions in SimpleDate.cpp & Parseit.cpp

tried compile them - three main errors in SimpleDate.cpp

I''ve attached the lines of code which give the error. If you have some time to have a look it''ll be most helpful.

All the best

Ken


operator int() { return atoi(TheData);};

error message:

1>f:\my documents\visual studio 2008\projects\kenarray\kenarray\parseit.h(31) : error C2664: ''atoi'' : cannot convert parameter 1 from ''CString'' to ''const char *''
1>        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called




m_DateString.Format(%s%s%02d%04d",daysofweek [GetDayOfWeek()],monthsofyear [m_Month],m_Day,m_Year);

错误消息:




m_DateString.Format("%s %s %02d %04d", daysofweek[GetDayOfWeek()],monthsofyear[m_Month],m_Day,m_Year);

error message:

1>f:\my documents\visual studio 2008\projects\kenarray\kenarray\simpledate.cpp(346) : error C2664: ''void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)'' : cannot convert parameter 1 from ''const char [16]'' to ''const wchar_t *''
1>        with
1>        [
1>            BaseType=wchar_t,
1>            StringTraits=StrTraitMFC_DLL<wchar_t>
1>        ]
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast




return m_DateString;

错误消息:




return m_DateString;

error message:

f:\my documents\visual studio 2008\projects\kenarray\kenarray\simpledate.cpp(347) : error C2440: ''return'' : cannot convert from ''CString'' to ''LPCSTR''
1>        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called



/Edit M-另请参见CodeProject文章处理日期的简单类 [



/Edit M - See also CodeProject article A Simple Class To Handle Dates[^]

推荐答案

对于无人问及有多少人没有注意到在整洁文章"下提供的论坛供人们联系作者,或者谁认为所有这些内容都是由一小部分人创建的,他们也昼夜不停地在这个论坛上发言,我是无言以对的.如果有人有问题.
I am speechless as to how many people fail to notice the forum provided under neath articles for people to contact the author, or who assume that all this content was created by a small group of people who also man this forum day and night, in case someone has a question.


这篇关于日期函数编译问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆