title: C/C++ C4047 differs in levels of indirection from 'int'?
body: <p>So I am attempting to compile SQLite (using a different Target Device then is usually used) and I am getting a weird warning and error and I'm not sure what it means for how to fix it. Here is the message I get after I attempt to compile from within Visual Studio:</p>
  
  <blockquote>
    <p>4>Compiling...<br>
    4>interop.c<br>
    4> sqlite3.c(11857) : error C2220: warning treated as error - no 'object' file generated<br>
    4> sqlite3.c(11857) : warning C4013: 'localtime' undefined; assuming extern returning int<br>
    4> sqlite3.c(11857) : warning C4047: '=' : 'tm *' differs in levels of indirection from 'int'<br>
    4> sqlite3.c(28379) : error C2040: 'localtime' : 'tm *(const time_t *)' differs in levels of indirection from 'int ()' </p>
  </blockquote>
  
  <p>And here is the code on those lines:</p>
  
  <pre><code>#else
  {
      struct tm *pTm;
      sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER))
      pTm = localtime(&amp;t);                                //Line 11857
      y.Y = pTm-&gt;tm_year + 1900;                          
      y.M = pTm-&gt;tm_mon + 1;                              
      y.D = pTm-&gt;tm_mday;                                 
      y.h = pTm-&gt;tm_hour;                                 
      y.m = pTm-&gt;tm_min;                                  
      y.s = pTm-&gt;tm_sec;                                  
      sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
  }
  #endif
  </code></pre>
  
  <p>And the method definition for localtime() where it complains about line 28379 and the indirection:</p>
  
  <pre><code>/*************************************************************************
  ** 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 &amp; 0xFFFFFFFF);
    uTm.dwHighDateTime= (DWORD)(t64 &gt;&gt; 32);
    FileTimeToLocalFileTime(&amp;uTm,&amp;lTm);
    FileTimeToSystemTime(&amp;lTm,&amp;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 &amp;y;
  }
  </code></pre>
  
  <p><strong>EDIT</strong>
  Here is the struct definition too:</p>
  
  <pre><code>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 */
  };
  </code></pre>
  
  <p>I really haven't been able to figure out what "'tm*' differs in levels of indirection from 'int'" means or how to fix it, I'm not even really sure what the issue is since this compiles for Win32 but not for WinCE. </p>
  
  <p>Does anyone have any insight into the warning\error or how to fix it? Any help is greatly appreciated!</p>
  
  <p>Thanks!</p>