[ndnSIM] how to run a scenario written by myself

ChangWei 3193946107 at qq.com
Wed Mar 2 01:23:38 PST 2016


hello,    I am a beginner in ndn-simulator.I wrote a simple scenario(test2.cc) to try.The scenario i wrote just like 'ndn-simple.cc'.And i put it in folder<ndnSIM-scenario-scenarios>.Then,when i input 'sudo ./waf --run=test2',there are many errors on my screen,just like
'/usr/local/include/ns3-dev/ns3/type-id.h:374:1: note: in expansion of macro ‘ATTRIBUTE_HELPER_HEADER’
 ATTRIBUTE_HELPER_HEADER (TypeId);
 ^
In file included from /usr/local/include/ns3-dev/ns3/object-base.h:23:0,
                 from /usr/local/include/ns3-dev/ns3/object.h:29,
                 from /usr/local/include/ns3-dev/ns3/scheduler.h:25,
                 from /usr/local/include/ns3-dev/ns3/calendar-scheduler.h:24,
                 from /usr/local/include/ns3-dev/ns3/core-module.h:19,
                 from ../scenarios/test2.cc:3:
/usr/local/include/ns3-dev/ns3/type-id.h:374:33: warning: extra ‘;’ [-Wpedantic]
 ATTRIBUTE_HELPER_HEADER (TypeId);
                                 ^
In file included from /usr/local/include/ns3-dev/ns3/simulator-impl.h:26:0,
                 from /usr/local/include/ns3-dev/ns3/default-simulator-impl.h:24,
                 from /usr/local/include/ns3-dev/ns3/core-module.h:24,
                 from ../scenarios/test2.cc:3:
/usr/local/include/ns3-dev/ns3/nstime.h:912:30: warning: extra ‘;’ [-Wpedantic]
 ATTRIBUTE_VALUE_DEFINE (Time);
                              ^
/usr/local/include/ns3-dev/ns3/nstime.h:918:33: warning: extra ‘;’ [-Wpedantic]
 ATTRIBUTE_ACCESSOR_DEFINE (Time);'


so, i don't know how to solve it! Please help me!
And following is my scenario 'test2.cc':


#include "ns3/core-module.h"

#include "ns3/network-module.h"

#include "ns3/point-to-point-module.h"

#include "ns3/ndnSIM-module.h"

using namespace ns3;

int 
main (int argc,char *argv[])

{
Config::SetDefault ("ns3::PointToPointNetDevice::DataRate",StringValue ("1Mbps"));

Config::SetDefault ("ns3::PointToPointChannel::Delay",StringValue ("10ms"));

Config::SetDefault ("ns3::DropTailQueue::MaxPackets",StringValue ("10"));
CommandLine cmd;

cmd.Parse (argc, argv);

NodeContainer nodes;

nodes.Create (7);



PointToPointHelper p2p;

p2p.Install (nodes.Get (0), nodes.Get(1));

p2p.Install (nodes.Get (1), nodes.Get(2));

p2p.Install (nodes.Get (2), nodes.Get(3));

p2p.Install (nodes.Get (3), nodes.Get(4));

p2p.Install (nodes.Get (4), nodes.Get(5));

p2p.Install (nodes.Get (5), nodes.Get(6));

ndn::StackHelper ndnHelper;

ndnHelper.SetDefaultRoutes (true);

ndnHelper.InstallAll ();

ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");

consumerHelper.SetAttribute ("Frequency",StringValue ("10"));

consumerHelper.Install (nodes.Get (0));

ndn::AppHelper producerHelper ("ns3::ndn::Producer");

producerHelper.SetPrefix ("/prefix");

producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));

producerHelper.Install (nodes.Get (6));

Simulator::Stop (Seconds (20.0));
Simulator::Run ();
Simulator::Destroy ();
return 0;

}
Thank you very much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20160302/a2bb0875/attachment.html>


More information about the ndnSIM mailing list