问题描述
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[^]
推荐答案
这篇关于日期函数编译问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!