如何在Omnet ++项目上使用LEDA图形库? [英] How to use LEDA graph library on Omnet++ projects?

查看:166
本文介绍了如何在Omnet ++项目上使用LEDA图形库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Omnet ++ 4.2.2中使用LEDA-6.3库.我安装了LEDA,并在Ubuntu终端上使用它运行了一个简单的程序,没有任何问题.但是,当我将代码移植到Omnet ++时,它将失败.下面是我的简单代码.

I am trying to use LEDA-6.3 library in Omnet++ 4.2.2. I installed LEDA and ran a simple program using it without problem from Ubuntu terminal. However, when I port the code to Omnet++, it fails. Below is my simple code.

    #include <LEDA/graph/graph.h>
    #include <omnetpp.h>

    class cLeda : public cSimpleModule
    {
      protected:
        virtual void initialize();
    };

    Define_Module(cLeda);

    void cLeda::initialize()
    {
        EV << "TestLEDA";
        graph g;
        g.read("nsfnet.txt");
        EV << "No. nodes = " <<g.number_of_nodes() << endl;
    }

我为编译器和链接器配置了LEDA路径,如下所示:项目->属性->选择C/C ++常规->路径和符号并添加:

I configured for LEDA paths for compiler and linker as follows: Project -> Properties --> Choose C/C++ General -> Path and Symbols and added:

  • 对于库路径:/home/grsst/LEDA-6.3/incl
  • 对于库:/home/grsst/LEDA-6.3/libleda.a(我没有添加libleda.o 因为它甚至在Ubuntu命令行中也无法使用)
  • 对于库路径:/home/grsst/LEDA-6.3
  • For Library Paths: /home/grsst/LEDA-6.3/incl
  • For Libraries: /home/grsst/LEDA-6.3/libleda.a (I didn't add libleda.o since it doesn't work even with Ubuntu command line)
  • For Library Paths: /home/grsst/LEDA-6.3

编译时,出现如下错误:

When I compile, the I got errors as follows:

   Description  Resource    Path    Location    Type
   make: *** [all] Error 2  TestLeda            C/C++ Problem
   make[1]: *** [../out/gcc-debug/src/TestLeda] Error 1 TestLeda            C/C++ Problem
   undefined reference to `leda::graph::~graph()'   cLeda.cc    /TestLeda/src   line 26 C/C++ Problem
   undefined reference to `leda::graph::graph()'    cLeda.cc    /TestLeda/src   line 24 C/C++ Problem
   undefined reference to `leda::graph::read(leda::string)' cLeda.cc    /TestLeda/src   line 25 C/C++ Problem
   undefined reference to `leda::memory_manager_init::~memory_manager_init()'   TestLeda        line 145, external               location: /home/grsst/LEDA-6.3/incl/LEDA/system/memory_std.h   C/C++ Problem
   undefined reference to `leda::memory_manager_init::memory_manager_init()'    TestLeda        line 145, external        location: /home/grsst/LEDA-6.3/incl/LEDA/system/memory_std.h  C/C++ Problem
   undefined reference to `leda::memory_manager::deallocate_bytes(void*, unsigned int)' TestLeda        line 52, external location: /home/grsst/LEDA-6.3/incl/LEDA/internal/handle_types.h  C/C++ Problem
   undefined reference to `leda::std_memory_mgr'    TestLeda        line 52, external        location: /home/grsst/LEDA-6.3/incl/LEDA/internal/handle_types.h   C/C++ Problem
   undefined reference to `leda::string::string(char const*)'   cLeda.cc    /TestLeda/src   line 25 C/C++ Problem

我非常感谢有任何想法可以帮助我实现这一目标.谢谢你一百万.

I appreciate any idea to help me to make it work. Thanks a million.

推荐答案

OMNeT++项目通常使用Makefile.尝试将LEDA库添加为Makefrag. 转到Project Properties,选择OMNeT++ |. Makemake |选择src | Options | Custom | Makefrag并写:

OMNeT++ project usually uses Makefile. Try to add LEDA libraries as a Makefrag. Go to Project Properties, choose OMNeT++ | Makemake | select src | Options | Custom | Makefrag and write:

    INCLUDE_PATH += -I/home/grsst/LEDA-6.3/incl
    LIBS += -L/home/grsst/LEDA-6.3  -lleda

这篇关于如何在Omnet ++项目上使用LEDA图形库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆