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

Muhammad Hosain Abdollahi Sabet mhasabet at gmail.com
Sat May 28 01:05:36 PDT 2016


​Hello everyone,

Using 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 *.hpp*s 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20160528/ec9c952d/attachment.html>


More information about the ndnSIM mailing list