问题
I'm trying to add the mp-olsr(ns 2.29) into ns 2.34 and I'm getting some errors while compiling it.
Source code(Jiazi YI): http://www.jiaziyi.com/index.php/research-projects/mp-olsr
Procedure:
$ touch common/packet.cc
$ make
Result:
mpolsr/MPOLSR.o: In function
MPOLSR::MPOLSR(int)':
Agent::Agent(packet_t)'
MPOLSR.cc:(.text+0x1457): undefined reference to
mpolsr/MPOLSR.o: In functionMPOLSR::MPOLSR(int)':
Agent::Agent(packet_t)'
MPOLSR.cc:(.text+0x16f1): undefined reference to
collect2: ld returned 1 exit status
make: ** [ns] Erro 1
What could I have missed?
回答1:
Before add the new protocol you need to add your protocol name into common/packet.h file after that add your xxx.o \ into Makefile than enter make command in your terminal window..
What you have done is not correct.
回答2:
In order to solve my error I modified the following in MPOLSR.cc:
From:
MPOLSR::MPOLSR(nsaddr_t id) : Agent(PT_MPOLSR),
hello_timer_(this),
tc_timer_(this),
mid_timer_(this) {
To(everything on a single line):
MPOLSR::MPOLSR(nsaddr_t id) : Agent(PT_MPOLSR), hello_timer_(this),tc_timer_(this), mid_timer_(this) {
I know it sounds silly, but it resolved the problem.
来源:https://stackoverflow.com/questions/15904571/compilation-error-while-adding-mp-olsr-on-ns-2-34-jiazi-yi-ns-2-29