Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6041257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:38:06+00:00 2026-05-23T06:38:06+00:00

So I am attempting to compile SQLite (using a different Target Device then is

  • 0

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:

4>Compiling…
4>interop.c
4> sqlite3.c(11857) : error C2220: warning treated as error – no ‘object’ file generated
4> sqlite3.c(11857) : warning C4013: ‘localtime’ undefined; assuming extern returning int
4> sqlite3.c(11857) : warning C4047: ‘=’ : ‘tm *’ differs in levels of indirection from ‘int’
4> sqlite3.c(28379) : error C2040: ‘localtime’ : ‘tm *(const time_t *)’ differs in levels of indirection from ‘int ()’

And here is the code on those 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 the indirection:

/*************************************************************************
** 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 the struct definition too:

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 */
};

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.

Does anyone have any insight into the warning\error or how to fix it? Any help is greatly appreciated!

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:38:07+00:00Added an answer on May 23, 2026 at 6:38 am

    The declaration of your localtime function is not available at the point it is being used. Under C rules, the compiler therefore assumes it’s an unknown function returning an int. It then warns about converting that int to a tm* (that’s what the “levels of indirection” thing is about).

    The solution is to declare localtime somewhere so that the compiler can see it when compiling sqlite3.c, like in a header file included from that file.

    The second “levels of indirection” message (the error) seems to be because you are defining localtime after it was used, so the compiler already has guessed the signature to have an int return type, and your actual signature differs from that.

    Make sure a correct declaration of localtime is available before the point where it is used. Simply put, you need to place the line

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

    somewhere before line 11857. You can put the definition (the function body) wherever you want, just make sure the declaration (the function signature) is known before the function is used anywhere.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When attempting to compile I am getting the following errors Error(16,8): PLS-00103: Encountered the
When attempting to compile my C# project, I get the following error: 'C:\Documents and
I am attempting to compile a c++ class using gcc. Due to the nature
I'm attempting to compile a working copy of the MagickNet class library (DLL) using
I am having a strange compile time error message when attempting to compile one
I am receiving the following compile time error when attempting to extend the SimpleButton
When attempting to compile mpd with Sun Studio compiler: client.c, line 438: warning: implicit
All this originated from me poking at a compiler warning message (C4267) when attempting
Attempting to insert an escape character into a table results in a warning. For
Attempting to print out a list of values from 2 different variables that are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.