[ndnSIM] error when simulating link failure
Alex Afanasyev
alexander.afanasyev at ucla.edu
Mon Apr 29 10:37:40 PDT 2013
Just put the definition of the FailLink function before the main function. Or at least, put the prototype of FailLink before main:
void FailLink (Ptr<NetDevice> nd);
---
Alex
On Apr 29, 2013, at 7:53 AM, yao hu <huyao0107 at gmail.com> wrote:
> Hi Alex,
>
> I added the following code to simulate the link failure between node n1 and n2 at 10 seconds. But it is strange it produces the error " ‘FailLink’ was not declared in this scope" as follows..
>
> ../src/ndnSIM/examples/ndn-linkfailure.cc: In function ‘int main(int, char**)’:
> ../src/ndnSIM/examples/ndn-linkfailure.cc:160:40: error: ‘FailLink’ was not declared in this scope
>
> Thanks in advance!
>
> ----------------------------------
>
> int
> main (int argc, char *argv[])
> {
> ......
>
> Ptr<Node> device1 = Names::Find<Node> ("n1");
> Ptr<Node> device2 = Names::Find<Node> ("n2");
>
> Simulator::Schedule (Seconds (10.0), FailLink, device1);
> Simulator::Schedule (Seconds (10.0), FailLink, device2);
>
> Simulator::Run ();
> Simulator::Destroy ();
>
> return 0;
> }
>
> void
> FailLink (Ptr<NetDevice> nd)
> {
> Ptr<RateErrorModel> error = CreateObject<RateErrorModel> ();
> error->SetAttribute ("ErrorRate", DoubleValue (1.0));
>
> nd->SetAttribute ("ReceiveErrorModel", PointerValue (error));
> }
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
More information about the ndnSIM
mailing list