I can not create my new module in ns3

136 views
Skip to first unread message

tenbea...@gmail.com

unread,
Apr 8, 2018, 9:57:48 AM4/8/18
to ns-3-users
Hi all,
    I want to create a new routing protocol,and I  found a module named "sp-routing"  from a website.It is a routing module that others used. Then when I want add it to my NS3,
some errors occured.The following is an error code:

pjf@pjf-virtual-machine:~/NS3/NS328$ ./waf build
Waf: Entering directory `/home/pjf/NS3/NS328/build'
[ 628/2757] Compiling install-ns3-header: ns3/sp-routing-helper.h
[ 629/2757] Compiling install-ns3-header: ns3/sp-routing.h
[ 630/2757] Compiling install-ns3-header: ns3/sp-routing-table.h
[ 946/2757] Processing gen-module-header: ns3/sp-routing-module.h
[1192/2757] Compiling src/sp-routing/helper/sp-routing-helper.cc
[1193/2757] Compiling src/sp-routing/model/sp-routing.cc
In file included from ./ns3/object-base.h:23:0,
                 from ./ns3/object.h:29,
                 from ./ns3/ipv4.h:24,
                 from ../src/sp-routing/model/sp-routing.cc:22:
./ns3/type-id.h: In instantiation of ‘static ns3::ObjectBase* ns3::TypeId::AddConstructor()::Maker::Create() [with T = ns3::ShortestPathRouting]’:
./ns3/type-id.h:659:3:   required from ‘ns3::TypeId ns3::TypeId::AddConstructor() [with T = ns3::ShortestPathRouting]’
../src/sp-routing/model/sp-routing.cc:40:43:   required from here
./ns3/type-id.h:656:34: error: invalid new-expression of abstract class type ‘ns3::ShortestPathRouting’
       ObjectBase * base = new T ();
                                  ^
In file included from ../src/sp-routing/model/sp-routing.cc:27:0:
../src/sp-routing/model/sp-routing.h:30:7: note:   because the following virtual functions are pure within ‘ns3::ShortestPathRouting’:
functions are pure within ‘ns3::ShortestPathRouting’:
 class ShortestPathRouting : public Ipv4RoutingProtocol
       ^
In file included from ./ns3/ipv4-static-routing.h:33:0,
                 from ../src/sp-routing/model/sp-routing.cc:26:
./ns3/ipv4-routing-protocol.h:172:16: note: virtual void ns3::Ipv4RoutingProtocol::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper>, ns3::Time::Unit) const
   virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const = 0;

My code file has been uploaded。Thankyou!

Regards

Peng.

 
sp-routing.cc
sp-routing.h

Konstantinos

unread,
Apr 9, 2018, 4:27:39 AM4/9/18
to ns-3-users
Please refer to the manual on how you create a new module

tenbea...@gmail.com

unread,
Apr 9, 2018, 9:56:35 AM4/9/18
to ns-3-users
Thankyou! I'm sure I'm following the instructions.The error seems to be because of my code。

在 2018年4月9日星期一 UTC+8下午4:27:39,Konstantinos写道:
Reply all
Reply to author
Forward
0 new messages