【发布时间】:2017-03-21 19:09:48
【问题描述】:
我正在尝试在 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 路径配置如下:项目 -> 属性 -> 选择 C/C++ 常规 -> 路径和符号并添加:
- 对于库路径:/home/grsst/LEDA-6.3/incl
- 对于库:/home/grsst/LEDA-6.3/libleda.a(我没有添加 libleda.o 因为即使使用 Ubuntu 命令行它也不起作用)
- 对于库路径:/home/grsst/LEDA-6.3
编译时出现如下错误:
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
我很感激任何可以帮助我实现它的想法。谢谢一百万。
【问题讨论】:
标签: omnet++