0
#include <time.h>
struct timespec first_tm1;
int ts_compare(struct timespec *time1, struct timespec *time2)
{
if (time1->tv_sec < time2->tv_sec)
    return -1; /* Less than. */
}

It gives the following :

Error C2079 'first_tm1' uses undefined struct 'timespec'

Error C2037 left of 'tv_sec' specifies undefined struct/union 'timespec'

Community
  • 1
  • 1
  • 1
    I have voted to close, because normal things don't work in MSVC, and there are a few questions about this specifically, like: http://stackoverflow.com/questions/6188907/timespec-on-windows-compilers – Grady Player May 20 '16 at 13:39
  • here is a reference where they got it to work with external GNU library: https://github.com/libusb/libusb/issues/63 – Grady Player May 20 '16 at 13:41
  • Posix is not Windows and is not C. Using all lowercase letters and no leading underscore hides that pretty well for everybody it seems :) Use a [standard C library function instead](http://www.cplusplus.com/reference/ctime/difftime/). – Hans Passant May 20 '16 at 13:45
  • I can't reproduce it. – cremno May 20 '16 at 13:58
  • @HansPassant: `struct timespec` is standard C. – cremno May 20 '16 at 14:00
  • Just add here, this code is compile & working fine in x86 configuration. Not compiling in x64 configuration – Sukumar Ghorai May 20 '16 at 19:46
  • I am facing compilation error for Debug build only (release build ok). Error C2079 'first_tm' uses undefined struct 'timespec' testbot C:\Users\sghorai\development\my-first-driver\logger.c 325 – Sukumar Ghorai Jun 28 '16 at 11:29

0 Answers0