I constructed ns3 correctly and likewise constructed netanim. Now getting this error after ./ns3 run first.cc
beneath is the code of first.cc
/*
* SPDX-License-Identifier: GPL-2.0-only
*/
#embrace "ns3/applications-module.h"
#embrace "ns3/core-module.h"
#embrace "ns3/internet-module.h"
#embrace "ns3/network-module.h"
#embrace "ns3/point-to-point-module.h"
#embrace "ns3/netanim-module.h"
#embrace "ns3/animation-interface.h"
// Default Community Topology
//
// 10.1.1.0
// n0 -------------- n1
// point-to-point
//
utilizing namespace ns3;
NS_LOG_COMPONENT_DEFINE("FirstScriptExample");
int
foremost(int argc, char* argv[])
{
CommandLine cmd(__FILE__);
cmd.Parse(argc, argv);
Time::SetResolution(Time::NS);
LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
NodeContainer nodes;
nodes.Create(2);
PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute("DataRate", StringValue("5Mbps"));
pointToPoint.SetChannelAttribute("Delay", StringValue("2ms"));
NetDeviceContainer units;
units = pointToPoint.Set up(nodes);
InternetStackHelper stack;
stack.Set up(nodes);
Ipv4AddressHelper tackle;
tackle.SetBase("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer interfaces = tackle.Assign(units);
UdpEchoServerHelper echoServer(9);
ApplicationContainer serverApps = echoServer.Set up(nodes.Get(1));
serverApps.Begin(Seconds(1.0));
serverApps.Cease(Seconds(10.0));
UdpEchoClientHelper echoClient(interfaces.GetAddress(1), 9);
echoClient.SetAttribute("MaxPackets", UintegerValue(1));
echoClient.SetAttribute("Interval", TimeValue(Seconds(1.0)));
echoClient.SetAttribute("PacketSize", UintegerValue(1024));
ApplicationContainer clientApps = echoClient.Set up(nodes.Get(0));
clientApps.Begin(Seconds(2.0));
clientApps.Cease(Seconds(10.0));
// NetAnim xml technology
AnimationInterface anim ("anim1.xml");
anim.SetConstantPosition(nodes.Get(0),1.0,2.0);
anim.SetConstantPosition(nodes.Get(1),2.0,3.0);
Simulator::Run();
Simulator::Destroy();
return 0;
}
getting this error
/usr/bin/ld: /house/rafidahmed/Downloads/ns-allinone-3.43/ns-3.43/examples/tutorial/first.cc:68:(.textual content.startup+0x6cc): undefined reference to `ns3::AnimationInterface::SetConstantPosition(ns3::Ptr<:node>, double, double, double)'
/usr/bin/ld: /house/rafidahmed/Downloads/ns-allinone-3.43/ns-3.43/examples/tutorial/first.cc:69:(.textual content.startup+0x702): undefined reference to ns3::AnimationInterface::SetConstantPosition(ns3::Ptr<:node>, double, double, double)' /usr/bin/ld: /house/rafidahmed/Downloads/ns-allinone-3.43/ns-3.43/examples/tutorial/first.cc:74:(.textual content.startup+0x71c): undefined reference to
ns3::AnimationInterface::~AnimationInterface()’
/usr/bin/ld: /house/rafidahmed/Downloads/ns-allinone-3.43/ns-3.43/examples/tutorial/first.cc:74:(.textual content.startup+0x98e): undefined reference to `ns3::AnimationInterface::~AnimationInterface()’
collect2: error: ld returned 1 exit standing
ninja: construct stopped: subcommand failed.