next up previous contents index
Next: Static Libraries for MS Up: Technical Information Previous: Usage of Header Files   Contents   Index

Subsections


Object Code on UNIX

Files and Directories

To compile and link your programs with LEDA, the LEDA main directory should contain at least the following files and subdirectories:
Readme.txt Readme File
Install/unix.txt txt-version of this section
incl/ the LEDA include directory
libleda.a (libleda.so) the LEDA library

The static library has the extension .a. If a shared library is provided it has extension .so.

Preparations

Unpacking the LEDA distribution file LEDA-<ver>-<sys>-<cc>.tar.gz will create the LEDA root directory "LEDA-<ver>-<sys>-<cc>". You might want to rename it or move it to some different place. Let <LEDA> denote the final complete path name of the LEDA root directory.

To install and use the Unix object code of LEDA you have to modify your environment as follows:

Compiling and Linking Application Programs

  1. Use the -I compiler flag to tell the compiler where to find the LEDA header files.
          CC (g++) -I$LEDAROOT/incl -c file.c
    

  2. Use the -L compiler flag to tell the compiler where to find the library.
          CC (g++)  -L$LEDAROOT file.o -lleda -lX11 -lm
    

    When using graphics on Solaris systems you might have to link with the system socket library and the network services library as well:

          CC (g++)  ... -lleda -lX11 -lsocket -lnsl -lm
    
    Remark: The libraries must be given in the above order.

  3. Compile and link simultaneously with
          CC (g++)  -I$LEDAROOT/incl -L$LEDAROOT file.c  -lleda -lX11 -lm
    

You may want to ask your system administrator to install the header files and libraries in the system's default directories. Then you no longer have to specify header and library search paths on the compiler command line.

Example programs and demos

The source code of all example and demo programs can be found in $LEDAROOT/test and $LEDAROOT/demo. Goto $LEDAROOT/test or $LEDAROOT/demo and type make to compile and link all test or demo programs, respectively.

Important Remark: When using g++ version 4.x.x or higher with optimization level 2 (-O2) or higher, you should always compile your sources setting the following flag:

-fno-strict-aliasing


next up previous contents index
Next: Static Libraries for MS Up: Technical Information Previous: Usage of Header Files   Contents   Index
Christian Uhrig 2017-04-07