Sunday 15 March 2015

How to import ns2 in eclipse and start debugging

In this post I am going to describe How to open ns-2 in Eclipse without any make error?

If after installing ns-2 in Eclipse
Error: *****No make target 'all'.stop

1) Error comes because eclipse is not able to find makefile. As the makefile is itself present in ns-allinone-2.35/ns-2.35 folder but it is write-protected and eclipse don't have premissions to read it.

2) Change the permissions of the complete ns-2 folder by following commands
    a)First go to the ns-allione-2.35 folder by using cd command
    b)Then give permissions by "sudo chmod 777 *"
    c)All files permissios in folder will change

3) Now reimport the whole folder in eclipse
Suggestion: change the workspace while importing folder

4) Either change your make target or change the workspace in build configuration because your main makefile is in the ns-2.35 folder but by default it will search in  the main ns-allione-2.35 folder. 
So go to project -> build configuration -> c/c++ -> in workspace browse to the ns-2.35 folder
or 
project -> properties ->c/c++ -> and in workspace browse to the ns-2.35 folder

or

you can type the path for the makefile file in make command like
make -f  path
replace path with where your makefile is in ns-2.35 folder.

then compile it. It will able to compile the ns2.

How to Run your topology from Eclipse for debugging purpose?

In this tutorial "~/ns-allinone-2.35/ns-2.35/tcl/ex/example.tcl" is used.
1- Select Run>>Debug Configurations.
2- In Main Tab>>C/C++ Application, write "ns" without quotation marks.
3- In Arguments Tab>>Program arguments, write "example.tcl" without quotation marks.
4- In Arguments Tab>>Working directory, write "~/ns-allinone-2.35/ns-2.35/tcl/ex/" without quotation marks.
5- In Debugger Tab, uncheck "Stop on start up at main".
6- Click Apply then Debug.

Good luck to all students. If you like this post please like it, share it and comment it. Enjoy and have fun. Visit often for new posts.

8 comments:

  1. It is really helpful. I am waiting for the new posts. Thanks.

    ReplyDelete
  2. Sir
    When i done the above steps to run simulation file that is wpan_demo2.tcl in my case give following error. kindly guide me in this regard.

    Error:
    ======


    ns: stop: couldn't execute "nam": no such file or directory

    while executing

    "exec nam wpan_demo2.nam &"

    (procedure "stop" line 13)

    invoked from within

    "stop"

    ReplyDelete
  3. I got the solution of following error i.e.,

    Error:
    ======


    ns: stop: couldn't execute "nam": no such file or directory

    while executing

    "exec nam wpan_demo2.nam &"

    (procedure "stop" line 13)

    invoked from within

    "stop"

    =======================
    Solution:

    Copy
    ns and nam files in /usr/local/bin/ directory of ubuntu

    ReplyDelete
  4. Error in final launch sequence
    Failed to execute MI command:
    maintenance set python print-stack off
    Error message from debugger back end:
    Undefined maintenance set command: "python print-stack off". Try "help maintenance set".
    Undefined maintenance set command: "python print-stack off". Try "help maintenance set".

    ReplyDelete
  5. Kindly help. i am using Eclipse IDE for C/C++ Linux Developers (includes Incubating components). this error occured when ever i debug. thanks in advance

    ReplyDelete

Related Posts

Related Posts Plugin for WordPress, Blogger...