sheredom / utest.h

🧪 single header unit testing framework for C and C++

Home Page:https://www.duskborn.com/utest_h/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

utest.h doesn't compile in WSL

g-berthiaume opened this issue · comments

Problem
utest.h won't compile on WSL.

It seems to be related to the time function.

> make
gcc -Isrc/ -std=c11 -W -Wall -Wextra -pedantic -Os -g3 -Wshadow -Wdouble-promotion -Wformat=2 -Wformat-truncation -Wundef -fno-common -Wconversion -fsanitize=address -c tests/tests.c
In file included from tests/tests.c:5:
tests/utest.h: In function ‘utest_ns’:
tests/utest.h:201:9: error: unknown type name ‘clockid_t’
  201 |   const clockid_t cid = CLOCK_REALTIME;
      |         ^~~~~~~~~
tests/utest.h:201:25: error: ‘CLOCK_REALTIME’ undeclared (first use in this function)
  201 |   const clockid_t cid = CLOCK_REALTIME;
      |                         ^~~~~~~~~~~~~~
tests/utest.h:201:25: note: each undeclared identifier is reported only once for each function it appears in
tests/utest.h:203:3: warning: implicit declaration of function ‘clock_gettime’ [-Wimplicit-function-declaration]
  203 |   clock_gettime(cid, &ts);
      |   ^~~~~~~~~~~~~
Makefile:32: recipe for target 'tests.o' failed
make: *** [tests.o] Error 1

More info
OS: Windows10 x64
WSL OS: ubuntu 18
Windows Build: 18363.900
Compiler: gcc (Ubuntu 9.3.0-11ubuntu0~18.04.1) 9.3.0
GLIBC: ldd (Ubuntu GLIBC 2.27-3ubuntu1.2) 2.27

Regards