C++ error: undefined reference to 'clock_gettime' and 'clock_settime'

后端 未结 4 442
予麋鹿
予麋鹿 2020-12-02 07:10

I am pretty new to Ubuntu, but I can\'t seem to get this to work. It works fine on my school computers and I don\'t know what I am not doing. I have checked usr/in

4条回答
  •  悲哀的现实
    2020-12-02 07:59

    I encountered the same error. My linker command did have the rt library included -lrt which is correct and it was working for a while. After re-installing Kubuntu it stopped working.

    A separate forum thread suggested the -lrt needed to come after the project object files. Moving the -lrt to the end of the command fixed this problem for me although I don't know the details of why.

提交回复
热议问题