Please help-undefined reference to

476 views
Skip to first unread message

Hassan Zeb

unread,
Jun 30, 2022, 12:15:59 AM6/30/22
to ns-3-users
Hi,
I am new to ns3. I am using energy harvesting module for my research work. I want to add sender node to receiver node neighbor list when a packet received from sender. For this purpose, i copied the aodv-neighbor.cc and .h file to energy harvester module and rename it as myneighbor.cc, .h. Also i added myneighbor.cc,.h to wscript of energy harverting module. Now when i run ./make it give me the following error.

087/2676] Linking build/src/energy/examples/ns3.34-li-ion-energy-source-debug
/usr/bin/ld: lib/libns3.34-energy-debug.so: undefined reference to `ns3::ArpCache::Entry::IsExpired() const'
/usr/bin/ld: lib/libns3.34-energy-debug.so: undefined reference to `ns3::ArpCache::Entry::GetMacAddress() const'
/usr/bin/ld: lib/libns3.34-energy-debug.so: undefined reference to `ns3::ArpCache::Lookup(ns3::Ipv4Address)'
/usr/bin/ld: lib/libns3.34-energy-debug.so: undefined reference to `typeinfo for ns3::WifiMacHeader'
/usr/bin/ld: lib/libns3.34-energy-debug.so: undefined reference to `ns3::ArpCache::Entry::IsAlive()'
/usr/bin/ld: lib/libns3.34-energy-debug.so: undefined reference to `ns3::ArpCache::Entry::IsPermanent()'
/usr/bin/ld: lib/libns3.34-energy-debug.so: undefined reference to `ns3::WifiMacHeader::GetAddr1() const'
collect2: error: ld returned 1 exit status

Waf: Leaving directory `/home/hassan/ns-allinone-3.34/ns-3.34/build'
Build failed
 -> task in 'li-ion-energy-source' failed with exit status 1 (run with -v to display more information)
make: *** [Makefile:4: all] Error 1
Note1: that arp-cache.h is availible in myneighbor.h
Note2. if any one have a simple code for neighbor node entry then please send me.
BR

BIKASH MAZUMDAR

unread,
Jun 30, 2022, 1:19:54 AM6/30/22
to ns-3-...@googlegroups.com

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/6097ce5b-89b9-4ea2-9bc8-befe176c3845n%40googlegroups.com.

Hassan Zeb

unread,
Jun 30, 2022, 1:45:00 AM6/30/22
to ns-3-users
I have checked it but not good for me, thanks for your reply

Soulimane Mammar

unread,
Jun 30, 2022, 4:00:15 AM6/30/22
to ns-3-users
Hi,
These are  linking errors. The linker has to know the location of all used libraries. This is why ns3 is using waf (recently switched to cmake) to automate all that stuff for you.
Try using waf to build your project
Regards

Hassan Zeb

unread,
Jun 30, 2022, 11:43:41 AM6/30/22
to ns-3-users
Sir,
I have build my project as home/ns-allinone-3.34/ns-3.34/./waf but still facing the same problem
BR

Soulimane Mammar

unread,
Jun 30, 2022, 3:23:09 PM6/30/22
to ns-3-users
Hi,
Do the following

$ cd /home/ns-allinone-3.34/ns-3.34/
$ ./waf build

Regards

Vipin Maurya

unread,
Jul 5, 2022, 2:14:03 PM7/5/22
to ns-3-users
Hi Mr. Souliman,
I am also facing same type of problem and i am doing
$ cd /home/ns-allinone-3.34/ns-3.34/
$ ./waf build
these steps but it still shows same error.
/usr/bin/ld: lib/libns3.35-GROP-debug.so: undefined reference to `RoutingTable::~RoutingTable()'
/usr/bin/ld: lib/libns3.35-GROP-debug.so: undefined reference to `RoutingProtocol::send(ns3::Ptr<ns3::Ipv4Route>, ns3::Ptr<ns3::Packet const>, ns3::Ipv4Header const&)'
/usr/bin/ld: lib/libns3.35-GROP-debug.so: undefined reference to `RoutingProtocol::AssignStreams(long)'
/usr/bin/ld: lib/libns3.35-GROP-debug.so: undefined reference to `GzrpPacket::~GzrpPacket()'
/usr/bin/ld: lib/libns3.35-GROP-debug.so: undefined reference to `vtable for RoutingTableEntry'

Please Help Regarding this.

Soulimane Mammar

unread,
Jul 5, 2022, 4:03:32 PM7/5/22
to ns-3-...@googlegroups.com
Hi,

This is a linking problem
In the wscript corresponding to your new module you probably need to specify aodv as a dependency like
bld.create_ns3_module('GROP', ['network','aodv'])

Regards




--
Soulimane MAMMAR

Vipin Maurya

unread,
Jul 6, 2022, 1:46:59 AM7/6/22
to ns-3-users
Hello Mr. Souliman ,
Thanks for your reply ,
As you suggest i specify aodv dependency in my module but it still shows same error the error file scree shot and wscript file i attach below .
Please help me regarding this.
wscript
Screenshot from 2022-07-06 11-16-04.png

Soulimane Mammar

unread,
Jul 6, 2022, 3:35:27 AM7/6/22
to ns-3-...@googlegroups.com
Hi,
Have you reconfigured ns3 after changing the wscript? because you should
$ ./waf configure

Regards



--
Soulimane MAMMAR

Vipin Maurya

unread,
Jul 6, 2022, 4:08:38 AM7/6/22
to ns-3-...@googlegroups.com
Hello ,
Yes i reconfigure the name after changing the script and after that when i do : ./waf build 
It shows same error .


Vipin Maurya

unread,
Jul 6, 2022, 4:09:32 AM7/6/22
to ns-3-...@googlegroups.com
#name -. NS3 

Tom Henderson

unread,
Jul 6, 2022, 11:18:35 AM7/6/22
to ns-3-...@googlegroups.com, Vipin Maurya
This is probably a namespace issue. All AODV code is wrapped in an
'aodv' namespace within namespace 'ns3'. Most ns-3 code is not like
this (most ns-3 code is within the 'ns3' namespace) but a few modules
have defined their own namespace.

To use that AODV code in another namespace, you should preface the names
of the methods with 'aodv::', such as 'aodv::RoutingProtocol' instead
of simply 'RoutingProtocol'.

> <http://libns3.35-GROP-debug.so>: undefined
> reference to `GzrpPacket::~GzrpPacket()'

However, the above missing reference is not related to AODV; perhaps you
are missing a destructor.

- Tom



On 7/6/22 01:09, Vipin Maurya wrote:
> #name -. NS3
>
> On Wed, Jul 6, 2022, 1:38 PM Vipin Maurya <vipinma...@gmail.com
> <mailto:vipinma...@gmail.com>> wrote:
>
> Hello ,
> Yes i reconfigure the name after changing the script and after that
> when i do : ./waf build
> It shows same error .
>
>
> On Wed, Jul 6, 2022, 1:05 PM Soulimane Mammar
> <souliman...@gmail.com <mailto:souliman...@gmail.com>> wrote:
>
> Hi,
> Have you reconfigured ns3 after changing the wscript? because
> you should
> $ ./waf configure
>
> Regards
>
> On Wed, Jul 6, 2022 at 6:47 AM Vipin Maurya
> <vipinma...@gmail.com <mailto:vipinma...@gmail.com>>
> wrote:
>
> Hello Mr. Souliman ,
> Thanks for your reply ,
> As you suggest i specify aodv dependency in my module but it
> still shows same error the error file scree shot and wscript
> file i attach below .
> Please help me regarding this.
>
> On Wednesday, July 6, 2022 at 1:33:32 AM UTC+5:30
> souliman...@gmail.com <mailto:souliman...@gmail.com> wrote:
>
> Hi,
>
> This is a linking problem
> In the wscript corresponding to your new module you
> probably need to specify aodv as a dependency like
> bld.create_ns3_module('GROP', ['network','aodv'])
>
> Regards
>
>
> On Tue, Jul 5, 2022 at 7:14 PM Vipin Maurya
> <vipinma...@gmail.com> wrote:
>
> Hi Mr. Souliman,
> I am also facing same type of problem and i am doing
> $ cd /home/ns-allinone-3.34/ns-3.34/
> $ ./waf build
> these steps but it still shows same error.
> /usr/bin/ld: lib/libns3.35-GROP-debug.so
> <http://libns3.35-GROP-debug.so>: undefined
> reference to `RoutingTable::~RoutingTable()'
> /usr/bin/ld: lib/libns3.35-GROP-debug.so
> <http://libns3.35-GROP-debug.so>: undefined
> reference to
> `RoutingProtocol::send(ns3::Ptr<ns3::Ipv4Route>,
> ns3::Ptr<ns3::Packet const>, ns3::Ipv4Header const&)'
> /usr/bin/ld: lib/libns3.35-GROP-debug.so
> <http://libns3.35-GROP-debug.so>: undefined
> reference to `RoutingProtocol::AssignStreams(long)'
> /usr/bin/ld: lib/libns3.35-GROP-debug.so
> <http://libns3.35-GROP-debug.so>: undefined
> reference to `GzrpPacket::~GzrpPacket()'
> /usr/bin/ld: lib/libns3.35-GROP-debug.so
> <http://libns3.35-GROP-debug.so>: undefined
> <https://github.com/IrfanJabandzic/MfTDMA-ns-3>
> lib/libns3.34-energy-debug.so <http://libns3.34-energy-debug.so/>:
> undefined reference to
> `ns3::ArpCache::Entry::IsExpired()
> const'
> /usr/bin/ld:
> lib/libns3.34-energy-debug.so <http://libns3.34-energy-debug.so/>:
> undefined reference to
> `ns3::ArpCache::Entry::GetMacAddress()
> const'
> /usr/bin/ld:
> lib/libns3.34-energy-debug.so <http://libns3.34-energy-debug.so/>:
> undefined reference to
> `ns3::ArpCache::Lookup(ns3::Ipv4Address)'
> /usr/bin/ld:
> lib/libns3.34-energy-debug.so <http://libns3.34-energy-debug.so/>:
> undefined reference to
> `typeinfo for
> ns3::WifiMacHeader'
> /usr/bin/ld:
> lib/libns3.34-energy-debug.so <http://libns3.34-energy-debug.so/>:
> undefined reference to
> `ns3::ArpCache::Entry::IsAlive()'
> /usr/bin/ld:
> lib/libns3.34-energy-debug.so <http://libns3.34-energy-debug.so/>:
> undefined reference to
> `ns3::ArpCache::Entry::IsPermanent()'
> /usr/bin/ld:
> lib/libns3.34-energy-debug.so <http://libns3.34-energy-debug.so/>:
> <https://groups.google.com/d/msgid/ns-3-users/6097ce5b-89b9-4ea2-9bc8-befe176c3845n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> Posting to this group should follow these guidelines
> https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
> <https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting>
> ---
> You received this message because you are subscribed
> to the Google Groups "ns-3-users" group.
> To unsubscribe from this group and stop receiving
> emails from it, send an email to
> ns-3-users+...@googlegroups.com.
>
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ns-3-users/44db34c5-0f98-48f5-b73e-f01036479758n%40googlegroups.com
> <https://groups.google.com/d/msgid/ns-3-users/44db34c5-0f98-48f5-b73e-f01036479758n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
>
>
> --
> Soulimane MAMMAR
>
> --
> Posting to this group should follow these guidelines
> https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
> <https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting>
> ---
> You received this message because you are subscribed to the
> Google Groups "ns-3-users" group.
> To unsubscribe from this group and stop receiving emails
> from it, send an email to
> ns-3-users+...@googlegroups.com
> <mailto:ns-3-users+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ns-3-users/4438eea1-92d2-4121-ab7d-ccc381fa29fbn%40googlegroups.com
> <https://groups.google.com/d/msgid/ns-3-users/4438eea1-92d2-4121-ab7d-ccc381fa29fbn%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
>
>
> --
> Soulimane MAMMAR
>
> --
> Posting to this group should follow these guidelines
> https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
> <https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting>
> ---
> You received this message because you are subscribed to the
> Google Groups "ns-3-users" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to ns-3-users+...@googlegroups.com
> <mailto:ns-3-users+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ns-3-users/CAMMLk4ZNTZR6fVLAm1i2GWwWvz0cQJSxNi0GsjVVPtvb6CN0aw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ns-3-users/CAMMLk4ZNTZR6fVLAm1i2GWwWvz0cQJSxNi0GsjVVPtvb6CN0aw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
> --
> Posting to this group should follow these guidelines
> https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
> <https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting>
> ---
> You received this message because you are subscribed to the Google
> Groups "ns-3-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ns-3-users+...@googlegroups.com
> <mailto:ns-3-users+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ns-3-users/CA%2BxAxuw2oQRqMUp_JLhGx7xn%2Bci%2BuNj%2BsCo2sXtkgr19siLO9A%40mail.gmail.com
> <https://groups.google.com/d/msgid/ns-3-users/CA%2BxAxuw2oQRqMUp_JLhGx7xn%2Bci%2BuNj%2BsCo2sXtkgr19siLO9A%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Message has been deleted

Hassan Zeb

unread,
Jul 6, 2022, 12:14:32 PM7/6/22
to ns-3-users
i have solved the problem and posted a complete answer but i don't know who deleted it. however, i have copied
def build(bld):
    obj = bld.create_ns3_module('energy', ['core', 'network', 'spectrum', 'stats', 'buildings', 'virtual-net-device','point-to-point','applications','internet','csma']) from lte wscript and run it with waf configure now their is no error and build succesfully.BR

Vipin Maurya

unread,
Jul 6, 2022, 2:42:22 PM7/6/22
to ns-3-users

Hello All,
I am new in NS3 and i am trying to configure Geographic Routing Module in NS3 . To configure it, First i download the source code from Github , the link of that code is :  https://github.com/manet-sih/manet_gzrp.git
Now after downloading the code i am trying to configure and build these code in ns3 for this i am doing these things :
1 . Apply New Module Building Method
2. Build New module in NS3.35/Contrib
3. changing the required wscript file
4. Apply  ./waf configure
5. Applt ./waf build
Now, the problem is that it shows error like :
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingTable::~RoutingTable()'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `GzrpPacket::~GzrpPacket()'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingTableEntry::setChangedState(bool)'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `ns3::Header::GetSerializedSize() const'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `vtable for RoutingTable'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingTableEntry::getDsptIp() const'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingProtocol::INTERZONE_PORT'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `vtable for RoutingProtocol'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingTableEntry::getEntryState() const'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `Metric::~Metric()'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingProtocol::GetTypeId()'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingTableEntry::getSeqNumber() const'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingTableEntry::setLifeTime(ns3::Time)'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `vtable for Metric'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingProtocol::drop(ns3::Ptr<ns3::Packet const>, ns3::Ipv4Header const&, ns3::Socket::SocketErrno)'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingTableEntry::setEntryState(EntryState)'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingProtocol::INTRAZONE_PORT'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingProtocol::send(ns3::Ptr<ns3::Ipv4Route>, ns3::Ptr<ns3::Packet const>, ns3::Ipv4Header const&)'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingProtocol::AssignStreams(long)'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingTableEntry::~RoutingTableEntry()'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `vtable for RoutingTableEntry'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingTableEntry::setSettlingTime(ns3::Time)'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `typeinfo for RoutingProtocol'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingTableEntry::getNextHop() const'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `GzrpPacket::~GzrpPacket()'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingTableEntry::getLifeTime() const'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingTableEntry::isChanged()'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingTableEntry::setNextHop(ns3::Ipv4Address)'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingProtocol::recvInterzoneControlPackets(ns3::Ptr<ns3::Socket>)'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingProtocol::getZoneId() const'
/usr/bin/ld: lib/libns3.35-NewGRP-debug.so: undefined reference to `RoutingTableEntry::getLink() const'

collect2: error: ld returned 1 exit status

And when i delete the file and folder which are presented in scratch folder (Default: Subdir & Scratch Simulator) then ./waf build run successfully . But after that when i put any file in scratch folder for execution it again shows same error.

For more understanding i attach the wscript file and error screenshot below .

Please help me what should i do to remove this type of error.
wscript
Screenshot from 2022-07-06 23-44-57.png
Screenshot from 2022-07-07 00-01-56.png
Reply all
Reply to author
Forward
0 new messages