我正在尝试在Omnet ++ 4.2.2中使用LEDA-6.3库。我安装了LEDA并运行了一个简单的程序,使用它没有Ubuntu终端的问题。但是,当我将代码移植到Omnet ++时,它失败了。下面是我的简单代码。
#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路径,如下所示:Project - &gt;属性 - &gt;选择C / C ++一般 - &gt;路径和符号并添加:
编译时,我得到的错误如下:
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
我很感激能帮助我让它发挥作用。万分感谢。
答案 0 :(得分:0)
OMNeT++
项目通常使用Makefile。尝试将LEDA
库添加为Makefrag
。
转到Project Properties
,选择OMNeT++
| Makemake
|选择src
| Options
| Custom
| Makefrag
并写下:
INCLUDE_PATH += -I/home/grsst/LEDA-6.3/incl
LIBS += -L/home/grsst/LEDA-6.3 -lleda