我正在尝试在 omnet++ 中设计一个网络(随机图),我想在其中使用 Lemon Graph Library 解析网络节点。我已经安装了该库,如果我尝试使用命令行在任何图形中编译任何带有节点和边的普通 c++ 文件,它工作正常g++ -o file file.cpp/cc -lemon
。但是当我用我的一个 omnet++ 项目(现在什么都没有)尝试它时,代码如下
#include <omnetpp.h>
#include <iostream>
#include <lemon/list_graph.h>
using namespace lemon;
using namespace std;
class Facility : public cSimpleModule
{
protected:
virtual void initialize();
virtual void handleMessage(cMessage *msg);
};
Define_Module(Facility);
void Facility :: initialize(){
}
void Facility :: handleMessage(cMessage *msg){
}`
包含标题在尖括号中(不要与双引号混淆)。因此,当我构建代码时,出现以下错误:
Description Resource Path Location Type
‘class cEnvir’ has no member named ‘push_back’ PSUC line 686, external location: /usr/local/include/lemon/bits/graph_extender.h C/C++ Problem
‘class cEnvir’ has no member named ‘push_back’ PSUC line 687, external location: /usr/local/include/lemon/bits/graph_extender.h C/C++ Problem
‘test’ does not name a type test.cc /ztest line 9 C/C++ Problem
invalid use of qualified-name ‘cSimulation::getActiveEnvir’ PSUC line 69, external location: /home/vijay/omnetpp-4.6/include/cenvir.h C/C++ Problem
make: *** [out/gcc-debug//psuc.o] Error 1 PSUC C/C++ Problem
make: *** [out/gcc-debug//test.o] Error 1 ztest C/C++ Problem
no matching function for call to ‘lemon::AlterationNotifier<lemon::GraphExtender<lemon::ListGraphBase>, lemon::ListGraphBase::Arc>::add(cEnvir&)’ PSUC line 688, external location: /usr/local/include/lemon/bits/graph_extender.h C/C++ Problem
为什么 Omnet++ 代码与 Lemon 图形库不兼容?