vs2010编译 c++ 程序提示 time.inl and error C2664 错误

 vs2010 用 C++ 写个小东西 编译的时候提示 

Warning 3 warning C4244: ‘argument’ : conversion from ‘time_t’ to ‘__time32_t’, possible loss of data c:\program files (x86)\microsoft visual studio 12.0\vc\include\time.inl 30

Error 4 error C2664: ‘char *_ctime32(const __time32_t *)’ : cannot convert argument 1 from ‘const time_t *’ to ‘const __time32_t *’ c:\program files (x86)\microsoft visual studio 12.0\vc\include\time.inl 36

Error 5 error C2664: ‘errno_t _ctime32_s(char *,size_t,const __time32_t *)’ : cannot convert argument 3 from ‘const time_t *’ to ‘const __time32_t *’ c:\program files (x86)\microsoft visual studio 12.0\vc\include\time.inl 42

Error 6 error C2664: ‘tm *_gmtime32(const __time32_t *)’ : cannot convert argument 1 from ‘const time_t *’ to ‘const __time32_t *’ c:\program files (x86)\microsoft visual studio 12.0\vc\include\time.inl 49

Error 7 error C2664: ‘errno_t _gmtime32_s(tm *,const __time32_t *)’ : cannot convert argument 2 from ‘const time_t *’ to ‘const __time32_t *’ c:\program files (x86)\microsoft visual studio 12.0\vc\include\time.inl 55

Error 8 error C2664: ‘tm *_localtime32(const __time32_t *)’ : cannot convert argument 1 from ‘const time_t *’ to ‘const __time32_t *’ c:\program files (x86)\microsoft visual studio 12.0\vc\include\time.inl 62

Error 9 error C2664: ‘errno_t _localtime32_s(tm *,const __time32_t *)’ : cannot convert argument 2 from ‘const time_t *’ to ‘const __time32_t *’ c:\program files (x86)\microsoft visual studio 12.0\vc\include\time.inl 67

Error 10 error C2664: ‘__time32_t _time32(__time32_t *)’ : cannot convert argument 1 from ‘time_t *’ to ‘__time32_t *’ c:\program files (x86)\microsoft visual studio 12.0\vc\include\time.inl 79

解决办法: 项目属性 -> C++ -> 预处理器 -> 预处理器定义   编辑 添加 _USE_32BIT_TIME_T

再次编译 OK  成功。

发表评论

您的电子邮箱地址不会被公开。