Thank you for your response David! I found instructions for compiling with mingw32 but that’s exactly what I want to avoid; I would like a binary linked against native windows runtime, so it can be included in a visual studio project :)
Martin > On Nov 12, 2019, at 5:48 AM, David Woodhouse <[email protected]> wrote: > > On Mon, 2019-11-11 at 10:32 -0500, Martin Vorbrodt wrote: >> Hi there! >> My name is Martin Vorbrodt, and I used oath toolkit for an example >> program that generates OTP: >> https://vorbrodt.blog/2019/03/20/two-factor-authentication/ >> >> I was able to compile it on Linux and Mac, but not on Windows. I can >> not locate source for binaries for windows. Could some please help me >> with this? >> >> I recently started porting all my blog code examples to windows VC >> 2019 and this (and two others) is the one I still need to port. > > I would probably go for just building with mingw32 on Linux. > > Not that it builds, but it shouldn't be hard to fix... > > CC usersfile.lo > usersfile.c: In function 'parse_usersfile': > usersfile.c:175:9: warning: implicit declaration of function 'strptime'; did > you mean 'strftime'? [-Wimplicit-function-declaration] > ts = strptime (p, TIME_FORMAT_STRING, &tm); > ^~~~~~~~ > strftime > usersfile.c:175:7: warning: assignment to 'char *' from 'int' makes pointer > from integer without a cast [-Wint-conversion] > ts = strptime (p, TIME_FORMAT_STRING, &tm); > ^ > usersfile.c: In function 'update_usersfile': > usersfile.c:340:18: error: storage size of 'l' isn't known > struct flock l; > ^ > usersfile.c:346:16: error: 'F_WRLCK' undeclared (first use in this function) > l.l_type = F_WRLCK; > ^~~~~~~ > usersfile.c:346:16: note: each undeclared identifier is reported only once > for each function it appears in > usersfile.c:348:18: warning: implicit declaration of function 'fcntl'; did > you mean 'fcvt'? [-Wimplicit-function-declaration] > while ((rc = fcntl (fileno (lockfh), F_SETLKW, &l)) < 0 && errno == EINTR) > ^~~~~ > fcvt > usersfile.c:348:42: error: 'F_SETLKW' undeclared (first use in this function) > while ((rc = fcntl (fileno (lockfh), F_SETLKW, &l)) < 0 && errno == EINTR) > ^~~~~~~~ > usersfile.c:340:18: warning: unused variable 'l' [-Wunused-variable] > struct flock l; > ^ > usersfile.c:389:24: warning: implicit declaration of function 'fsync' > [-Wimplicit-function-declaration] > if (rc == OATH_OK && fsync (fileno (outfh)) != 0) > ^~~~~ > usersfile.c: In function 'oath_authenticate_usersfile': > usersfile.c:475:11: warning: implicit declaration of function 'localtime_r'; > did you mean 'localtime_s'? [-Wimplicit-function-declaration] > if (localtime_r (&t, &now) == NULL) > ^~~~~~~~~~~ > localtime_s > usersfile.c:475:34: warning: comparison between pointer and integer > if (localtime_r (&t, &now) == NULL) > ^~ > >
