[ndnSIM] Not being able to build pretty much the same TypeId

Alex Afanasyev aa at CS.UCLA.EDU
Sun May 29 12:52:32 PDT 2016


Without seeing actual code, I will not be able to say for sure what's going on (you need at least share a small snippet that shows the error).  One obvious thing is that you're using the same names as Consumer/Producer app in ndnSIM.  Unless you're using a dedicated namespace in your extension, this definitely should cause issues.

--
Alex

> On May 28, 2016, at 1:05 AM, Muhammad Hosain Abdollahi Sabet <mhasabet at gmail.com> wrote:
> 
> ​Hello everyone,
> 
> Using http://github.com/cawka/ndnSIM-scenario-template <http://github.com/cawka/ndnSIM-scenario-template>, I'm writing 2 custom applications. In TypeId they are pretty much the same:
> 
> TypeId
> Consumer::GetTypeId()
> {
>   static TypeId tid = TypeId ("Consumer")
>           .SetGroupName("Ndn")
>           .SetParent<ndn::App>()
>           .AddConstructor<Consumer>()
>           .AddAttribute("Prefix","Prefix, for which consumer sends interest", StringValue("/"),
>                         ndn::MakeNameAccessor(&Consumer::m_interestName),
>                         ndn::MakeNameChecker())
>           .AddAttribute("Hint","Forwarding Hint Name",
>                         StringValue("/"),
>                         MakeStringAccessor(&Consumer::m_linkName),
>                         MakeStringChecker())
>           .AddAttribute("HasLink","Does this app use Link?",
>                         BooleanValue(false),
>                         MakeBooleanAccessor(&Consumer::m_hasLink),
>                         MakeBooleanChecker())
>           .AddAttribute("LifeTime", "Interest Life Time",
>                         StringValue("2s"),
>                         MakeTimeAccessor(&Consumer::m_interestLifeTime),
>                         MakeTimeChecker());
> 
>   return tid;
> }
> 
> 
> And the other one is:
> 
> TypeId
> Producer::GetTypeId(){
>     static TypeId tid = TypeId ("Producer")
>             .SetGroupName("Ndn")
>             .SetParent<ndn::App>()
>             .AddConstructor<Producer>()
>              .AddAttribute("Prefix", "Prefix, for which producer has the data", StringValue("/"),
>                           MakeNameAccessor(&Producer::m_prefix),
>                           ndn::MakeNameChecker())
>              .AddAttribute("LinkName", "The Name of Forwarding Hint", StringValue("/"),
>                           MakeNameAccessor(&Producer::m_linkName),
>                           ndn::MakeNameChecker())
>              .AddAttribute("PayloadSize", "Virtual payload size for Content packets", UintegerValue(1024),
>                           MakeUintegerAccessor(&Producer::m_virtualPayloadSize),
>                           MakeUintegerChecker<uint32_t>())
>              .AddAttribute("Freshness", "Freshness of data packets, if 0, then unlimited freshness",
>                           TimeValue(Seconds(0)), MakeTimeAccessor(&Producer::m_freshness),
>                           MakeTimeChecker())
>              .AddAttribute("Signature","Fake signature, 0 valid signature (default), other values application-specific",
>                           UintegerValue(0),
>                           MakeUintegerAccessor(&Producer::m_signature),
>                           MakeUintegerChecker<uint32_t>())
>              .AddAttribute("KeyLocator","Name to be used for key locator.  If root, then key locator is not used",
>                           ndn::NameValue(),
>                           MakeNameAccessor(&Producer::m_keyLocator),
>                           ndn::MakeNameChecker())
>              .AddAttribute("HasLink","Define if the Producer uses Link",
>                           BooleanValue(false),
>                           MakeBooleanAccessor(&Producer::m_hasLink),
>                           MakeBooleanChecker());
>             ;
>     return tid;
> }
> 
> ​Producer is ok. But in ​Linking the other one I'm receiving:
> 
> extensions/Consumer.cpp.1.o: In function `ns3::AccessorHelper<ns3::Consumer, ns3::StringValue>::Set(ns3::ObjectBase*, ns3::AttributeValue const&) const':
> /usr/local/include/ns3-dev/ns3/attribute-accessor-helper.h:183: undefined reference to `typeinfo for ns3::Consumer'
> extensions/Consumer.cpp.1.o: In function `ns3::AccessorHelper<ns3::Consumer, ns3::StringValue>::Get(ns3::ObjectBase const*, ns3::AttributeValue&) const':
> /usr/local/include/ns3-dev/ns3/attribute-accessor-helper.h:209: undefined reference to `typeinfo for ns3::Consumer'
> extensions/Consumer.cpp.1.o: In function `ns3::AccessorHelper<ns3::Consumer, ns3::ndn::NameValue>::Set(ns3::ObjectBase*, ns3::AttributeValue const&) const':
> /usr/local/include/ns3-dev/ns3/attribute-accessor-helper.h:183: undefined reference to `typeinfo for ns3::Consumer'
> extensions/Consumer.cpp.1.o: In function `ns3::AccessorHelper<ns3::Consumer, ns3::ndn::NameValue>::Get(ns3::ObjectBase const*, ns3::AttributeValue&) const':
> /usr/local/include/ns3-dev/ns3/attribute-accessor-helper.h:209: undefined reference to `typeinfo for ns3::Consumer'
> extensions/Consumer.cpp.1.o: In function `ns3::TypeId ns3::TypeId::AddConstructor<ns3::Consumer>()::Maker::Create()':
> /ndnSIM/custom-scenario/link/build/../extensions/Consumer.hpp:22: undefined reference to `vtable for ns3::Consumer'
> collect2: error: ld returned 1 exit status
> 
> The .hpps are also pretty much the same. I've copied the ndn-custom-app and modified it.
> 
> Anyone has and idea what is wrong?
> 
> Thanks,
> Sabet
> 
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20160529/4fce13a8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20160529/4fce13a8/attachment.bin>


More information about the ndnSIM mailing list