So, I'm trying to compile SQLite (another target device is usually used), and I get a strange warning and error, and I'm not sure what that means to fix it. Here is the message that I get after trying to compile from Visual Studio:
4> Compilation ...
4> interop.c
4> sqlite3.c (11857): error C2220: warning, treated as an error - there is no file 'object' generated
4> sqlite3.c (11857): warning C4013: 'localtime 'undefined; Assuming extern returns int 4> sqlite3.c (11857): warning C4047: '=': 'tm *' differs in indirection levels from 'int'
4> sqlite3.c (28379): error C2040: 'localtime': 'tm * (const time_t *)' differs in indirection levels from 'int ()'
And here is the code on these lines:
{
struct tm *pTm;
sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER))
pTm = localtime(&t);
y.Y = pTm->tm_year + 1900;
y.M = pTm->tm_mon + 1;
y.D = pTm->tm_mday;
y.h = pTm->tm_hour;
y.m = pTm->tm_min;
y.s = pTm->tm_sec;
sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
}
And the method definition for localtime (), where it complains about line 28379 and indirect:
/*************************************************************************
** This section contains code for WinCE only.
*/
/*
** WindowsCE does not have a localtime() function. So create a
** substitute.
*/
struct tm *__cdecl localtime(const time_t *t)
{ // Line 28379
static struct tm y;
FILETIME uTm, lTm;
SYSTEMTIME pTm;
sqlite3_int64 t64;
t64 = *t;
t64 = (t64 + 11644473600)*10000000;
uTm.dwLowDateTime = (DWORD)(t64 & 0xFFFFFFFF);
uTm.dwHighDateTime= (DWORD)(t64 >> 32);
FileTimeToLocalFileTime(&uTm,&lTm);
FileTimeToSystemTime(&lTm,&pTm);
y.tm_year = pTm.wYear - 1900;
y.tm_mon = pTm.wMonth - 1;
y.tm_wday = pTm.wDayOfWeek;
y.tm_mday = pTm.wDay;
y.tm_hour = pTm.wHour;
y.tm_min = pTm.wMinute;
y.tm_sec = pTm.wSecond;
return &y;
}
EDIT
Here is also a definition of the structure:
struct tm {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
};
, "tm *" "int", , , , Win32, WinCE.
- \ ? !
!