Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Xi library?

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2010

    Xi library?

    In my Makefile I have the following:

    objects = main.o Asteroid.o Bullet.o Projectile.o Ship.o
    asteroids: $(objects)
    g++ -o asteroids $(objects) -lX11 -lXi -lglut -lGL -lGLU -lm

    I got the library switches from the OpenGL SuperBible. I was wondering what the -lXi switch is for because I tried the same program on my laptop and the -lXi switch is not recognized?


  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Install the libXi and libXi-devel packages on your laptop.

    On UNIX/Linux, -l<library> is the standard way to tell the compiler/linker to link an executable or shared library with the specified library.

    Generally speaking, -lFOO tells he compiler to go look for a library or libFOO.a. Where it looks by default for this library is based on whether you're compiling on a 32-bit machine (/usr/lib) or 64-bit machine (/usr/lib64). Other directories may be searched as well.

    On your laptop, you most likely don't have the libXi binary and development (headers) packages installed. For instance, here on OpenSuSE 12.2:

    Code :
    > rpm -qa | grep Xi
    >rpm -ql libXi6

    Here the name of my Xi packages are "libXi6" and "libXi-devel".

    So if I specify -lXi on the linker line, that says to go look for the* library, which the linker will find in /usr/lib64.
    Could have put /usr/lib64/ on the linker line instead, but that's needless verbosity and doesn't support cross-architecture compiles nor having the library installed someplace else on the system.

Posting Permissions

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