Results 1 to 3 of 3

Thread: Unable to link library Libtermcap with g++

  1. #1

    Default Unable to link library Libtermcap with g++

    Hello,

    I've install Termcap with help of zypper as you can see below

    # zypper info termcap
    Loading repository data...
    Reading installed packages...


    Information for package termcap:
    --------------------------------
    Repository : Main Repository (OSS)
    Name : termcap
    Version : 2.0.8-1045.2
    Arch : x86_64
    Vendor : openSUSE
    Installed Size : 610.5 KiB
    Installed : Yes
    Status : up-to-date
    Source package : termcap-2.0.8-1045.2.src
    Summary : The Termcap Library
    Description :
    The termcap library.


    I see the library in /usr/lib64

    but when i try to link that library i get:
    patrick@linux-wzyg:~/projects/gnucap/gnucap/lib> g++ test_readline.cc -lreadline -ltermcap
    /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: cannot find -ltermcap
    collect2: error: ld returned 1 exit status


    I don't understand how it is different from eg. readline

    thanks for your help

  2. #2

    Default Re: Unable to link library Libtermcap with g++

    >rpm -ql termcap shows

    /usr/include/curses
    /usr/include/curses/curses.h
    /usr/include/termcap
    /usr/include/termcap/termcap.h
    /usr/lib64/curses
    /usr/lib64/curses/libcurses.a
    /usr/lib64/curses/libcurses.so
    /usr/lib64/libcurses.so.1
    /usr/lib64/libcurses.so.1.0.0
    /usr/lib64/libtermcap.so.2
    /usr/lib64/libtermcap.so.2.0.8
    /usr/lib64/termcap
    /usr/lib64/termcap/libtermcap.a
    /usr/lib64/termcap/libtermcap.so

    So it installs libtermcap.so to /usr/lib64/termcap , which isn't in the default searchpath of ld. You will need to add a -L/usr/lib64/termcap to the compiler/linker flags.

    IIRC libtermcap.so is hidden in that subdirectory because using libtermcap is considered to be deprecated and it is recommended to use ncurses instead.

  3. #3

    Default Re: Unable to link library Libtermcap with g++

    thanks. ir works with that directory.
    nice to learn on the rpm query command.
    i was confused as I saw termcap.so.2 in the root folder

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •