Undefined reference to a function in another library

前端 未结 4 1397
自闭症患者
自闭症患者 2021-01-25 04:24

I\'m trying to compile an object code with a reference to one lib. This is the code of libexample.c:

#include \"libexample.h\"
#include 
#include         


        
4条回答
  •  闹比i
    闹比i (楼主)
    2021-01-25 04:37

    Looks like you forgot to link in the library that defines timer_create and timer_settime -- you need to add -lrt to your gcc command.

    (source: http://www.kernel.org/doc/man-pages/online/pages/man2/timer_create.2.html)

提交回复
热议问题