settimeofday hidden

kostyan5
Posts: 50
Joined: Mon Mar 06, 2017 3:16 pm

settimeofday hidden

Postby kostyan5 » Mon Mar 27, 2017 5:02 pm

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.

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: settimeofday hidden

Postby ESP_igrr » Mon Mar 27, 2017 5:21 pm

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.

kostyan5
Posts: 50
Joined: Mon Mar 06, 2017 3:16 pm

Re: settimeofday hidden

Postby kostyan5 » Mon Mar 27, 2017 5:49 pm

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.

Who is online

Users browsing this forum: No registered users and 201 guests