-
Mar 11th, 2024, 02:50 PM
#1
Thread Starter
Frenzied Member
[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?
-
Mar 11th, 2024, 07:24 PM
#2
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);
-
Mar 12th, 2024, 04:15 AM
#3
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)
-
Mar 12th, 2024, 04:23 AM
#4
Thread Starter
Frenzied Member
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
-
Mar 21st, 2024, 04:39 AM
#5
Re: Unresolved external for localtime - Microsoft C 5.10 for MS-DOS
 Originally Posted by Peter Swinkels
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):

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
-
Mar 21st, 2024, 05:32 AM
#6
Thread Starter
Frenzied Member
Re: Unresolved external for localtime - Microsoft C 5.10 for MS-DOS
-
Mar 25th, 2024, 04:14 AM
#7
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|