library not found for -lrt with QtCreator [mac os]

前端 未结 2 1417
有刺的猬
有刺的猬 2020-11-30 10:19

i\'m getting some troubles with QT it builds with option \"-lrt\"

i\'m using mac os 10.6 with QT creator 1.2.1, heeeeeeelp !

this is the full build command

相关标签:
2条回答
  • 2020-11-30 10:55

    Why does the program need librt?

    I know that some platforms (Solaris comes to mind) require librt for some functions which might exist in other libraries in your OS. (sem_init() et al. are like this)

    You might try to link without -lrt and see if it works.

    0 讨论(0)
  • 2020-11-30 11:00

    The linker cannot find librt which is probably the Posix real time extensions library. I don't think this is available on OSX. Googling gives this from Apple developer lists

    Question from list

    I'm trying to build a simulator developed in my university (on Linux) and I get error by the linker that seems unable to find librt.a - in the code is used for clock_gettime() and I would like to know if there's a port of such library, or some other similar function that allows me to compile even on Mac OS X.

    Answer librt.a is the System V name of the library containing the POSIX Advanced Realtime [RT} Option functions. The specific function you are asking about is part of the [TMR] option. If Mac OS X supported it, it would be in libSystem.B,dylib, not librt.a. The function in question is not supported by Mac OS X.

    Your code should check to see whether optional to implement things above and beyond the UNIX standard are implemented in the target OS, and if they aren't, use a different interface.

    0 讨论(0)
提交回复
热议问题