error with a new example, undefined reference

401 views
Skip to first unread message

mikacros

unread,
Apr 2, 2012, 11:45:13 AM4/2/12
to ns-3-users
Hi,
I've created a module for simulate a simplified satellite link and I
want to create an example.
In this example, I just want to see if a ping message exchange
works .
However, I got a error that I really don't understand in that case.

error :
[1627/1806] cxxprogram: build/src/satellite-device/examples/satellite-
device-example.cc.1.o -> build/src/satellite-device/examples/satellite-
device-example
src/satellite-device/examples/satellite-device-example.cc.1.o: In
function `main':
/home/mika/ns3/ns-allinone-3.13/ns-3.13/build/../src/satellite-device/
examples/satellite-device-example.cc:44: undefined reference to
`ns3::V4PingHelper::V4PingHelper(ns3::Ipv4Address)'
/home/mika/ns3/ns-allinone-3.13/ns-3.13/build/../src/satellite-device/
examples/satellite-device-example.cc:47: undefined reference to
`ns3::V4PingHelper::Install(ns3::Ptr<ns3::Node>) const'
collect2: ld returned 1 exit status


Code:

/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"

#include "ns3/internet-stack-helper.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/satellite-device-helper.h"
#include "ns3/internet-module.h"
#include "ns3/v4ping-helper.h"
#include "ns3/v4ping.h"
#include "ns3/ipv4-address-helper.h"

using namespace ns3;


int
main (int argc, char *argv[])
{
bool verbose = true;

CommandLine cmd;
cmd.AddValue ("verbose", "Tell application to log if true",
verbose);

cmd.Parse (argc,argv);

/* ... */
NodeContainer c ;
c.Create(3);

SatelliteDeviceHelper satHelp;
InternetStackHelper internet;
NetDeviceContainer devs = satHelp.Install(c);
internet.Install(c);

Ipv4AddressHelper ipv4Left;
ipv4Left.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer interfacesLeft = ipv4Left.Assign (devs);

V4PingHelper ping = V4PingHelper(Ipv4Address("10.1.1.2"));
ApplicationContainer apps = ping.Install(c.Get(1));
apps.Start (Seconds (2.0));
apps.Stop (Seconds (5.0));




Simulator::Run ();
Simulator::Destroy ();
return 0;
}

Mitch Watrous

unread,
Apr 2, 2012, 5:32:38 PM4/2/12
to ns-3-users
From your code, it looks like your example depends on these modules:

core-module
network-module
applications-module
satellite-device
internet-module

Make sure that your module's example's wscript file:

src/satellite-device/examples/wscript

specifies that your example depends on the above modules by doing
something like this:

obj = bld.create_ns3_program('satellite-device-example', ['core',
'network', 'applications', 'satellite-device', 'internet'])
])
obj.source = 'satellite-device-example.cc'

Mitch

mikacros

unread,
Apr 4, 2012, 5:10:47 AM4/4/12
to ns-3-users
thanks a lot

Craig

unread,
Apr 24, 2012, 6:43:44 AM4/24/12
to ns-3-...@googlegroups.com
Hi 

I am new to NS-3 and had looked at the possibility of using NS-3 to model a satellite link. Is your module available in the repository? 

Craig
Reply all
Reply to author
Forward
0 new messages