I'm attempting to write a patch for dwm that uses clock_gettime(3), but
I cannot figure out how to get librt properly linked to the build.

In config.mk, I changed the LIBS variable:

    -LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS}
    +LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} -lrt

Inside dwm, I also have the include for time.h. However, when I attempt
to compile dwm with my patch, I get the following warning and error:

    dwm build options:
    CFLAGS   = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os 
-I/usr/X11R6/include -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION="6.1"
    LDFLAGS  = -s -L/usr/X11R6/lib -lX11  -lrt
    CC       = cc
    [...]
    dwm.c:1451:3: warning: implicit declaration of function ‘clock_gettime’ 
[-Wimplicit-function-declaration]
    dwm.c:1451:21: error: ‘CLOCK_MONOTONIC’ undeclared (first use in this 
function)

What am I doing wrong?

Thanks,
Eric

Reply via email to