Results 1 to 7 of 7

Thread: [RESOLVED] Unresolved external for localtime - Microsoft C 5.10 for MS-DOS

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,909

    Resolved [RESOLVED] Unresolved external for localtime - Microsoft C 5.10 for MS-DOS

    When I try to compile this from inside Quick C I get an "unresolved external" error for the localtime function:

    Code:
    #include <stdio.h>
    #include <time.h>
    
    int main() {
        time_t t = time(NULL);
        struct tm *tm_info = localtime(&t);
    
        char buffer[80];
        strftime(buffer, 80, "%A", tm_info);
    
        printf("Het is vandaag %s.\n", buffer);
    
        return 0;
    }
    The syntax appears to be correct from what I can gather by searching the internet. Anyone?

  2. #2
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,458

    Re: Unresolved external for localtime - Microsoft C 5.10 for MS-DOS

    I don't have MS C 5.10, but that above code works fine as-is in Borland C++ 2.0 for DOS (1991).

    For that version of Borland C++, Time.h contains this in reference to localtime:

    Code:
    struct tm _FAR * _Cdecl localtime(const time_t _FAR *__timer);

  3. #3
    Frenzied Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    1,148

    Re: Unresolved external for localtime - Microsoft C 5.10 for MS-DOS

    localtime() isn't one of the documented functions for quickc. See Appendix B of:
    https://www.pcjs.org/documents/books/mspl13/c/mspqc/
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,909

    Re: Unresolved external for localtime - Microsoft C 5.10 for MS-DOS

    Well, it appears to exist in my copy, there's this line in my time.h file:

    Code:
    struct tm * _CDECL localtime(const time_t *);
    Also:
    Attachment 190739

  5. #5
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,435

    Re: Unresolved external for localtime - Microsoft C 5.10 for MS-DOS

    Quote Originally Posted by Peter Swinkels View Post
    When I try to compile this from inside Quick C I get an "unresolved external" error for the localtime function:

    The syntax appears to be correct from what I can gather by searching the internet.
    The syntax is indeed correct...

    In case you're looking for a super-small C-compiler -
    I've successfully ran your code with "tcc" (the tiny-c-compiler from Bellard).

    Its download-size is less than 500kByte zipped.

    In case you already use VSCode as a Text-Editor...
    then the easiest way is, to simply install the tcc-module for it (as shown in the ScreenShot below):

    Name:  tcc.jpg
Views: 856
Size:  28.5 KB

    I've just installed the tcc-module, as shown to the left of the ScreenShot (takes just a few seconds) -
    Then I've pasted your code into a "test.c"-file - dragged it (as a new Tab) into VSCode -
    and then simply pressed <F10> (for the results to show up in the little "console-viewer" at the bottom)

    Olaf

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,909

    Re: Unresolved external for localtime - Microsoft C 5.10 for MS-DOS

    I sent you a dm.

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,909

    Re: [RESOLVED] Unresolved external for localtime - Microsoft C 5.10 for MS-DOS

    While I did not really resolve the issue, I decided to close this thread.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width