Page 1 of 1
settimeofday hidden
Posted: Mon Mar 27, 2017 5:02 pm
by kostyan5
Declaration of settimeofday() seems to be hidden behind #ifdef __BSD_VISIBLE (which I don't believe is defined). Is there a reason for this? I had to move the declaration out of that #ifdef for it to work.
Re: settimeofday hidden
Posted: Mon Mar 27, 2017 5:21 pm
by ESP_igrr
I can't reproduce this... __BSD_VISIBLE is set when compiling main.c from the template application and including <sys/time.h>.
Please check if you happen to have _ANSI_SOURCE, _C99_SOURCE, _C11_SOURCE defined in your translation unit for some reason. If you don't have any of these, then you should get __BSD_VISIBLE and settimeofday as a result.
Re: settimeofday hidden
Posted: Mon Mar 27, 2017 5:49 pm
by kostyan5
This issue was that <sys/cdefs.h> is not included in sys/time.h so if <sys/time.h> is included before anything else that includes cdefs.h, __BDS_VISIBLE never gets defined. After adding #include <sys/cdefs.h> before #include <sys/time.h>, the problem was fixed.
Thanks.