Как использовать графическую библиотеку LEDA в проектах Omnet++?
Я пытаюсь использовать библиотеку LEDA-6.3 в Omnet++ 4.2.2. Я установил 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 → Properties → Выбрать C/C++ General → Path and Symbols и добавил:
- Для путей к библиотеке: /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++
обычно использует 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