HOWTO configure NetBeans with ns-3
Jump to navigation
Jump to search
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.
- Under Run, Set Run Command to "./build/examples/tutorial/ns3-dev-first-debug" or any executable you want to run and debug.
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.
- A: Doing the following two things usually solves this.