Linking with librt - Linux

This is a discussion on Linking with librt - Linux ; Hi, I'm using clock_gettime and am trying to link with librt by using the ld command and specifying -llibrt. I also specify the following directories to search for librt: - /usr/lib - /lib - /usr/lib/gcc/i386-redhat-linux/3.4.3 - /lib/i686 - /lib/tls However, ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Linking with librt

  1. Linking with librt

    Hi,

    I'm using clock_gettime and am trying to link with librt by using the ld
    command and specifying -llibrt. I also specify the following directories to
    search for librt:
    - /usr/lib
    - /lib
    - /usr/lib/gcc/i386-redhat-linux/3.4.3
    - /lib/i686
    - /lib/tls

    However, ld says it can't find librt though librt.so is in /usr/lib, and
    files of similar name are in the other directories. What's wrong?

    Thanks,
    Jeremy



  2. Re: Linking with librt

    Hi Jeremy,

    > I'm using clock_gettime and am trying to link with librt by using the ld
    > command and specifying -llibrt. I also specify the following directories to
    > search for librt:


    Use the linker flag '-lrt', and not '-llibrt'.

    HTH,
    Loic.


+ Reply to Thread