[ndnSIM] NFD modification - Linker error
Ιωάννα Αγγελική Καπετανίδου
ikapetan at ee.duth.gr
Mon Apr 22 01:58:27 PDT 2019
Hello all,
I am trying to modify NFD forwarder.cpp in order for it to be able to
get a value from an application called NewConsumer. In the
NewConsumer.hpp file I have two public functions: void
setRating(uint32_t pr); and double getRating() const {return rating;}.
setRating is defined in the NewConsumer.cpp file. In NewConsumer.hpp,
I also have a public Constructor and a virtual Destructor,which are
defined in the NewConsumer.cpp file,too.
My program is located in ndnSIM/examples/[myfoldername] (I have
configured waf so that examples are enabled). When I create a
NewConsumer object in another .cpp file in myfolder it works fine.
However, my purpose is to incorporate setRating and getRating in
forwarder.cpp, as I want to control data caching and forwarding
operations.
I tried including NewConsumer.hpp and adding in
Forwarder::onIncomingData the following code lines:
ns3::Ptr<ns3::NewConsumer> newc = ns3::CreateObject<ns3::NewConsumer>();
newc->setRating(stoi(dt.toUri()));
std::cout << newc->getRating() << '\n';
When I do this I get a linker error:
./libns3-dev-ndnSIM-debug.so: undefined reference to
`ns3::NewConsumer::NewConsumer()'
./libns3-dev-ndnSIM-debug.so: undefined reference to
`ns3::NewConsumer::setRating(unsigned int)'
./libns3-dev-ndnSIM-debug.so: undefined reference to
`ns3::NewConsumer::GetTypeId()'
collect2: error: ld returned 1 exit status
Is there something else I have to do? Maybe include anything or
modifications at some wscript file?
Looking forward to hearing your advice.
Thank you in advance,
Ioanna
More information about the ndnSIM
mailing list