Why does getdate(char*) not compile in STM32CubeIDE? I cannot find an option to enable it.
Is there abother way of char* to tm struct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-22 10:42 AM
I see that the standard time.h is included. But getdate to convert a char* to tm does not coliple as it is not enabled. I have tried various project options with no joy.
Can someone let me know how to do this?
- Labels:
-
STM32CubeIDE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-22 10:47 AM
Doesn't compile, or doesn't link?
Assuming the latter you need to link against a full library not some limited, lite or cut-down one.
grep the library directory to find which, if any, contain the function.
Sure you could find some source if you looked too, and integrate that into the project.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-23 3:15 AM
Use strptime instead.
#define _XOPEN_SOURCE
#include <time.h>
/* ... */
struct tm tm;
strptime("2001-11-12 18:31:01", "%Y-%m-%d %H:%M:%S", &tm);
_XOPEN_SOURCE must be defined before the very first #include directive, not just before including <time.h>.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-23 5:24 AM
Thank you, I found this but it generates a compiler warning " warning: implicit declaration of function 'strptime'; did you mean 'strftime'? [-Wimplicit-function-declaration]".
is there a way to stop this. I try to keep warnings to 0 so I can see any that may actually cause a problem when running.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-23 5:31 AM
Again,
_XOPEN_SOURCE must be defined before the very first #include directive, not just before including <time.h>
What is the first non-comment line in the source file in which strptime() is called?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-07-11 7:30 PM
Many thanks, I used strptime and it works well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-11-18 2:02 PM
I determined this however it generates a compiler warning caution. implicit declaration of characteristic guidedid you mean strftime? Wimplicit function-statement
