C / C ++ C4047 differs in levels of indirection from 'int'?

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:

#else
{
    struct tm *pTm;
    sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER))
    pTm = localtime(&t);                                //Line 11857
    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));
}
#endif

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;     /* seconds after the minute - [0,59] */
    int tm_min;     /* minutes after the hour - [0,59] */
    int tm_hour;    /* hours since midnight - [0,23] */
    int tm_mday;    /* day of the month - [1,31] */
    int tm_mon;     /* months since January - [0,11] */
    int tm_year;    /* years since 1900 */
    int tm_wday;    /* days since Sunday - [0,6] */
    int tm_yday;    /* days since January 1 - [0,365] */
    int tm_isdst;   /* daylight savings time flag */
};

, "tm *" "int", , , , Win32, WinCE.

- \ ? !

!

+3
2

localtime , . C, , int. int tm* ( , " " ).

, localtime -, sqlite3.c, , .

" " () , localtime , , int, .

, localtime , . ,

struct tm *__cdecl localtime(const time_t *t);

- 11857. ( ) , , , ( ) , .

+9

extern sqlite3.c

int, struct tm.

+1

All Articles