- Home Page of ProjectGuideline.com ›
- Forums ›
- Get Help to do your B.E., and M.E., M.Tech., & M.S., Project in Ns2 ›
- Error Compile aodv.cc
Dear All,
I try to compile the aodv.cc using ns-2.31 on Fedora core 7 but it produces the following error:
[root@fsksm aodv]# g++ aodv.cc -o aodv
aodv.cc:35:18: error: aodv.h: No such file or directory
aodv.cc:36:25: error: aodv_packet.h: No such file or directory
aodv.cc:37:20: error: random.h: No such file or directory
aodv.cc:38:23: error: cmu-trace.h: No such file or directory
aodv.cc:59: error: ‘hdr_aodv’ has not been declared
aodv.cc:60: error: expected class-name before ‘{‘ token
aodv.cc: In constructor ‘AODVHeaderClass::AODVHeaderClass()’:
aodv.cc:62: error: class ‘AODVHeaderClass’ does not have any field named ‘PacketHeaderClass’
aodv.cc:63: error: ‘hdr_all_aodv’ was not declared in this scope
aodv.cc:64: error: ‘hdr_aodv’ has not been declared
aodv.cc:64: error: ‘bind_offset’ was not declared in this scope
aodv.cc: At global scope:
aodv.cc:68: error: expected class-name before ‘{‘ token
aodv.cc :71: error: ISO C++ forbids declaration of ‘TclObject’ with no type
aodv.cc:71: error: expected ‘;’ before ‘*’ token
aodv.cc:76: error: expected `;’ before ‘}’ token
aodv.cc: In constructor ‘AODVclass::AODVclass()’:
aodv.cc:70: error: class ‘AODVclass’ does not have any field named ‘TclClass’
aodv.cc: At global scope:
aodv.cc:80: error: ‘AODV’ has not been declared
My question is, why can’t the program find all the *.h header files when the location of the files is already correctly pointed.
Does compiling the aodv.cc file using the g++ command is correct? Or is there any other way?
For your info, I have done the “make clean, make depend & make” that later automatically created aodv.o, but it doesn’t solve my problem. The compiler still couldn’t find all the header files.
Do u have any idea on how to solve my problem? I really hope someone could guide me out of this problem because i can’t run my own code for my master’s project that requires to include several header files such as the aodv.h, aodv_packet.h, random.h and cmu-trace.h for they are not found by the compiler.
Regards,
Normalia Samian
If you are doing any change in any of the files of ns2, then don’t compile it separately. Instead of it, just change to the ns-allinone-2.xxns-2.xx directory and run make. It will use the Makefile and compile the whole project and create a new binary version of ns2 in the same directory. After that, you can install the new version of ns2 into appropriate path using “make install” command. Some times you have to run the script “configure” before make. Run the commands as follows.
#./configure (dot slash configure)
– the “configure” step is required only once and may not necessary if you are working on a previous installation of ns2.
#make
#make install
Thank you for the suggestions, however FYI i’ve done all the steps that u’ve suggested but my problems remain unresolved. The only temporary solution that i’m working now is to put all the header files into usr/include/ folder to make sure that gcc compiler find the #include header files. But, this solution is not effective since i’ve to make sure that all the sub-header files’ links are pointing on that folder to remove dependencies.
It seems that i need to set something to gcc compiler so it can detect all the header files automatically, but i don’t know how or where to set. Anybody knows about setting up the gcc compiler, please let me know.
Thank you.