Difference between revisions of "HOWTO configure NetBeans with ns-3"

From Nsnam
Jump to: navigation, search
(Fix Makefile tabs)
m (Fix headlines)
 
Line 34: Line 34:
 
** Waf clean and build get executed by NetBeans, this may take some time.
 
** Waf clean and build get executed by NetBeans, this may take some time.
  
=== Editing project properties ===
+
== Editing project properties ==
 
* Right click on ''ns-3-dev'' in ''Projects'' and select ''Properties''.
 
* Right click on ''ns-3-dev'' in ''Projects'' and select ''Properties''.
 
** Under ''Run'', Set ''Run Command'' to "./build/examples/tutorial/ns3-dev-first-debug" or any executable you want to run and debug.
 
** Under ''Run'', Set ''Run Command'' to "./build/examples/tutorial/ns3-dev-first-debug" or any executable you want to run and debug.
 
*** If you want to set it to "/build/examples/tutorial/ns3-dev-first-debug" make sure you used "--enable-examples" option in "./waf configure" under Makefile.
 
*** If you want to set it to "/build/examples/tutorial/ns3-dev-first-debug" make sure you used "--enable-examples" option in "./waf configure" under Makefile.
  
== Running programs ===
+
== Running programs ==
 
* Click ''Run Project (ns-3-dev)'' button.
 
* Click ''Run Project (ns-3-dev)'' button.
  

Latest revision as of 16:55, 25 January 2013

Basic Configuration

Idea taken from ns-3-users group post.

Makefile wrapper

NetBeans needs a Makefile to recognize a project as such. Create a file named Makefile inside ns-3-dev directory, containing the following.

# Makefile wrapper for waf

all:
	./waf

# free free to change this part to suit your requirements
configure:
	./waf configure --enable-examples --enable-tests

build:
	./waf build

install:
	./waf install

clean:
	./waf clean

distclean:
	./waf distclean

Importing project

  • Run "./waf shell", and then in the same terminal start NetBeans using "netbeans" command.
    • Inside NetBeans go to File->New Project..., choose C/C++->C++ Project with Existing Sources, and click Next >.
    • Choose ns-3-dev under Specify the folder that contains existing sources: and make sure that Auotomatic (using Makefile) is selected under Select Configuration Mode:. Click Finish.
    • Waf clean and build get executed by NetBeans, this may take some time.

Editing project properties

  • Right click on ns-3-dev in Projects and select Properties.
    • Under Run, Set Run Command to "./build/examples/tutorial/ns3-dev-first-debug" or any executable you want to run and debug.
      • If you want to set it to "/build/examples/tutorial/ns3-dev-first-debug" make sure you used "--enable-examples" option in "./waf configure" under Makefile.

Running programs

  • Click Run Project (ns-3-dev) button.

Debugging programs

  • Set breakpoints and click Debug Project (ns-3-dev) button.
  • To debug a running ns-3 program, use Attach Debugger... under Debug menu or Debug Project (ns-3-dev) button dropdown.

FAQ

  • Q: Code Assistance doesn't work in a particular file.
    • A: Doing the following two things usually solves this.
      • Right click on ns-3-dev in Projects and select Code Assistance->Reparse Project.
      • Change something in that particular file, save it and use Build Project (ns-3-dev) button or Run Project (ns-3-dev) button.