[ndnSIM] Compilation failure because of undefined reference

Alex Afanasyev alexander.afanasyev at ucla.edu
Mon Dec 17 10:44:57 PST 2012


Why do you put packet directly to content store from the app. It was never an intended behavior... Normally, you would reply to Interests by sending a data packet using m_protocolHandler(packet) call in a ndn::App-derivative class.

If you really want to proceed with manually putting packets to the content store, then you'll need a couple of changes. First, "packet" for the second parameter should be the payload only, not the full packet with NDN headers.

Second, you need to change your call to something like ``ContentStore::GetContentStore(GetNode())->Add(header,packet);``. The way you do it cannot work, as you're explicitly asking to call Add method of ContentStore class (base class), where this method is defined as pure virtual and never defined.


>> From: "T.Ogawara" <notifications at github.com>
>> Hi,
>> I'm trying to create custom apps on ndnSIM in /src/ndnSIM/apps.
>> But an error occured on compilation.
>> Here is the part of code.
>> #include "ns3/ndn-content-store.h"
>> void Chronos::SendMsg(){
>>  ContentObjectTail tail;
>>  Ptr<ContentObjectHeader> header = Create<ContentObjectHeader> ();
>>  header->SetName (Create<NameComponents> ("/prefix"));
>>  Ptr<Packet> packet = Create<Packet> (1024);
>>  packet->AddHeader (*header);
>>  packet->AddTrailer (tail);
>>  ContentStore::GetContentStore(GetNode())->ContentStore::Add(header,packet);
>>  */
>> }
>> I hoe this works, but this error occuered.
>> ./libns3-dev-ndnSIM-debug.so: undefined reference to `ns3::ndn::ContentStore::Add(ns3::Ptr, ns3::Ptr)'
>> collect2: ld returned 1 exit status
>> I tried but could not fix this.
>> Could you give me some hints to solve this?
>> Thank you.
> _______________________________________________
> 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