Part of the Khronos Group
OpenGL.org

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
    Posts
    28

    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?

    thanks,
    mike

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,213
    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 libFOO.so 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
    libXinerama1-1.1.2-2.1.2.x86_64
    libXinerama-devel-1.1.2-2.1.2.x86_64
    libXi-devel-1.6.1-2.1.2.x86_64
    libXi6-1.6.1-2.1.2.x86_64
     
    >rpm -ql libXi6
    /usr/lib64/libXi.so.6
    /usr/lib64/libXi.so.6.1.0

    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 libXi.so.* library, which the linker will find in /usr/lib64.
    Could have put /usr/lib64/libXi.so.6 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
  •