c++ - LEDA 库(C++ 库)设置 linux

标签 c++ linux leda

我想在我的系统中设置 LEDA 库。

我已经从以下链接下载了 LEDA 库

http://www.algorithmic-solutions.info/free/d5.php

    Instruction given in read me file



       2. Preparations
    ---------------

    Unpacking the LEDA distribution file 
    LEDA---.tar.gz will create the LEDA root 
    directory "LEDA---". You might want to rename 
    it or move it to some different place. Let  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: 

    a)  LEDAROOT:
    Set the environment variable LEDAROOT to the LEDA root directory: 

    csh/tcsh: setenv LEDAROOT  

    sh/bash: LEDAROOT= 
      export LEDAROOT 

    b)  Command Search Path:
    Include $LEDAROOT/Manual/cmd into your command search path 
    (environment variable path (csh) or PATH (sh)) and call rehash (if 
    required by your system). 

    c)  Shared Library: (for solaris, linux, irix, osf1) 
    If you planning to use shared libraries include $LEDAROOT into the 
    LD_LIBRARY_PATH search path. Then go to $LEDAROOT and type 
    make shared. This will construct the shared libraries from the static
    libraries. 
    Please note: Building the shared library is not supported on each
    platform.

    d)  xlman and demos: Go to $LEDAROOT and type make xlman to compile 
    and link LEDA's interactive manual reader xlman. Now you can start 
    xlman for reading and printing manual pages, starting demo programs 
    and browsing more release notes. 


    3. Compiling and linking application programs
    ---------------------------------------------

    a) Use the -I compiler flag to tell the compiler where to find the 
    LEDA header files.

    CC (g++) -I$LEDAROOT/incl -c file.c

    b) Use the -L compiler flag to tell the compiler where to find the 
    library (libleda.a/so)

    CC (g++)  -L$LEDAROOT file.o -lleda -lX11 -lm

    If using windows 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

    c) Compile and link simultaneously with

    CC (g++)  -I$LEDAROOT/incl -L$LEDAROOT file.c -lleda -lX11 -lm

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

我按照这些说明操作,但我在命令中遇到错误

> make xlman

    error
    coredump@coredump-VPCCB15FG:~/Documents/LEDA$ make xlman 
    make -C demo/xlman 
    make: *** demo/xlman: No such file or directory.  Stop.
    make: *** [xlman] Error 2

有人请帮我设置图书馆。

最佳答案

注意:对于 Leda 库的免费版本,您无需构建包即可使用该库。它根本行不通。

要使用该库,只需将其包含在您的编译行和链接器中即可。

如果您从 shell 编译(假设您使用的是 Linux),请执行以下操作:

1. Set the env variable to the library folder e.g export LEDAROOT= /path/to/Leda
2. Set the LD_LIBRARY_PATH env variable e.g export LD_LIBRARY_PATH=$LEDAROOT

验证是否已设置此变量,然后您可以编译、链接和运行。你可以简单地做

CC (g++)  -I$LEDAROOT/incl -L$LEDAROOT file.c -lleda -lX11 -lm

有了这个你就可以开始了。

如果您使用的是 IDE,只需将包含路径(即/path/to/leda)添加到您的项目设置中即可。

这就是您所要做的。 构建库不起作用。只需包含它

关于c++ - LEDA 库(C++ 库)设置 linux,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16551244/

相关文章:

c++ - CreateProcess() 没有正确启动进程

c - 杂项驱动程序和字符驱动程序有什么区别?

linux - 猫密码 | awk -F' :' ' {printf $1}' 这个命令正确吗?

c - 如何正确使用pidfile库?

c++ - LEDA库安装

boost-graph - LEDA 图 v/s Boost 图库

C++ Windows - 以编程方式检查软件是否访问互联网?

c++ - Visual Studio 无法识别 CUDA 的 "ThreadIdx"

c++ - Qt weatherinfo demo中,部分内容超出窗口边界

c++ - 代数数的计算