I m trying to modify some C++ files in ns2 and then recompile using make command. Although new .o file is created after make, the output is similar to that of previous C++ file (before modifying). can someone suggest what may 开发者_JAVA技巧be the reason behind it.
Make sure you're running your newly built ns2 executable -- if you just type ns2
, you'll get the installed ns2 binary on the system, which you haven't changed (unless you do a make install
and even then it might install it in a different place, leaving the old one where it is).
Generally you'll need to run ./ns2
if you want to make sure you get the executable in the current directory (which is probably the one you just built, but check the Makefile and the date on the executable to be more sure.)
This usually means you're not compiling what you think you are. Try renaming your source file and see if make still "compiles" it (it shouldn't). Alternatively, make sure you're saving your changes from your editor.
To get all the build time dependencies, you would
sudo apt-get build-dep ns2
Proceed to get the sources (46Mb approx) and compile
mkdir $HOME/ns2work
cd $HOME/ns2work
apt-get source ns2 --compile
You'd be done. (it built ns2, ns2-doc and ns2-examples in 2'55" on my workstation). Inside the source directory you can edit the source and run 'make' or debuild to rebuild using your changes.
When using this method (and debuild) you will end up with .deb files in mkdir $HOME/ns2work so you can actually install it cleanly (on several machines if you want)
Good luck
精彩评论