Undefined reference to a function in another library

前端 未结 4 1419
自闭症患者
自闭症患者 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条回答
  •  爱一瞬间的悲伤
    2021-01-25 04:34

    If you are using cmake, make sure you include the libraries using target_link_libraries(). For e.g., timer functions like timer_create() you need "rt" and for pthread you need "pthread" added using target_link_libraries().

提交回复
热议问题