我想在omnet ++中設計一個網絡(隨機圖),我想使用檸檬圖庫解析網絡節點。我已經安裝了該庫,如果我嘗試使用命令行g++ -o file file.cpp/cc -lemon
在任何圖形中編譯任何具有節點和邊的正常C++文件,它都可以正常工作。但是,當我與我的OMNET ++項目之一(現在在它沒有任何關係),試了一下它的代碼如下如何在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圖庫兼容?
http://stackoverflow.com/questions/19912682/c-error-no-matching-function-for-call-to –