Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot compile some simple D code

Tags:

d

I'm compiling some simple code:

import std.c.time;
.
.
.
timespec zero;
nanosleep(&zero, null);
.
.
.

What I get is:

Error: undefined identifier timespec
Error: undefined identifier nanosleep

std.c.time is merely a shortcut to C's time.h. If I call other functions defined in time.h, say clock(), it's Ok. If I write analogous code in C (with nanosleep()), it's Ok. In time.h I see that timespec and nanosleep declarations are put under some #ifdef, possibly it has something to do with my problem ?

How can I get it to compile ?

My working environment is: dmd v2.059 Ubuntu 12.04

like image 446
segfault Avatar asked Dec 11 '25 13:12

segfault


1 Answers

timespec and nanosleep is mentioned exactly 0 times in the C99 standard. It's not part of standard C, can not be found in a standard time.h file and thus can not be found in std.c.time.

like image 182
orlp Avatar answered Dec 13 '25 19:12

orlp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!