开发者

How to include CTime in my vc++ code

I have a need to use CTime in my code. I tried to add the header file "atltime.开发者_运维百科h" to this code. But now, I am getting so many errors in compiling. Every error is coming from the header file "afxconv.h". I searched msdn for CTime, but they didn't describe about this( may be I yet to see the proper page). I am using VisualStudio-2008, 64 bit. Can anybody point me the correct direction?


Sounds like you are having a conflict with the MFC and ATL version of CTime. Since you specify MFC in your tag I suspect that you want the MFC verion. The atltime.h is for ATL projects. Afx.h has CTime for MFC which AFAIK is normally always included in the stdafx.h


Can you show us your errors?

this code works just fine on a 32 bit computer with a win32 project with atl.

#include "stdafx.h"
#include <atltime.h>

int _tmain(int argc, _TCHAR* argv[])
{
    CTime ct;
    printf("day of week %d\n",ct.GetDayOfWeek());
    return 0;
}


You need to have #include <time.h>. Check the requirements part of the link. MSDN CTime


I included one file from code project, in that it uses some ASSERT,AfxisValidString. They included afx.h, for that. It is also the header for CTime. So, when I removed, and added atltime.h, then the ASSERT related things threw the errors. Sorry, I wated some of your precious time. I am going to vote to delete this question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜