HOWTO configure QtCreator with ns-3: Difference between revisions

From Nsnam
Jump to navigation Jump to search
m (make all and make clean)
No edit summary
Line 1: Line 1:
== Basic Configuration ==
== Basic Configuration ==
* Start QtCreator.
* Open a terminal; cd to the ns-3-dev directory and run "./waf configure --enable-examples" or whatever configuration is to your taste, and "./waf build".
* Run "./waf shell", and then '''in the same terminal''' start QtCreator using "qtcreator" command.
** Under or ''Tools''->''Options''->''Text Editor''
** Under or ''Tools''->''Options''->''Text Editor''
*** On ''Completion'' tab under '''Behavior''' enable '''Insert space after function name'''
*** On ''Completion'' tab under '''Behavior''' enable '''Insert space after function name'''
Line 33: Line 34:
**** '''Command arguments:''' should be "clean"
**** '''Command arguments:''' should be "clean"
** Under '''Run Settings'''
** Under '''Run Settings'''
*** Set '''Executable:''' to "./waf"
*** Set '''Executable:''' to "./build/examples/tutorial/ns3-dev-first-debug" or any executable you want to run and debug
*** Set '''Arguments:''' to "--run examples/tutorial/first" or whatever you need
**** If you set it to "examples/tutorial/first" make sure you used "--enable-examples" option in "./waf configure" prior to running the code
**** If you set it to "--run examples/tutorial/first" make sure you built examples prior to running the code
*** Leave '''Arguments:''' blank
*** '''Working directory:''' is again OK by default


== Unresolved issues ==
== FAQ ==
* '''Start Debugging''' doesn't work
* Q: I get an error "./build/examples/tutorial/ns3-dev-first-debug: error while loading shared libraries: libns3-dev-point-to-point-debug.so: cannot open shared object file: No such file or directory".
** A: Please make sure that you are running "qtcreator" inside "./waf shell".

Revision as of 18:21, 4 October 2012

Basic Configuration

  • Open a terminal; cd to the ns-3-dev directory and run "./waf configure --enable-examples" or whatever configuration is to your taste, and "./waf build".
  • Run "./waf shell", and then in the same terminal start QtCreator using "qtcreator" command.
    • Under or Tools->Options->Text Editor
      • On Completion tab under Behavior enable Insert space after function name
    • Under Tools->Options->C++
      • On Code Style tab set Current setting: to "GNU [built-in]"
      • On File Naming tab set Source suffix: to "cc"

Importing project

  • Go to File menu and select New File or Project.
  • Then go to Import Project->Import Existing Project and click Choose... button.
  • Project Name and Location
    • "Project name:" should be something like "qtcreator-project-ns-3-dev", because QtCreator will create couple of files in ns-3-dev directory and you want to be able to delete them easily if needed.
    • "Location:" should be your ns-3-dev directory.
    • Click Next >
  • File Selection
    • Click Next >
  • Project Management
    • Click Finish

Configuring project

  • Click Edit on the left; open "qtcreator-project-ns-3-dev.includes" file.
    • Edit the line "<path-to-ns-3-dev>/build/ns3" to be "<path-to-ns-3-dev>/build"
  • Click Projects on the left.
    • Under Build Settings
      • Remove make all under Build Steps, and click Add Build Step->Custom Process Step
        • 'Command: should be "./waf"
        • Working directory: is OK by default
        • Command arguments: should be "build"
      • Remove make clean under Clean Steps, and click Add Clean Step->Custom Process Step
        • 'Command: should be "./waf"
        • Working directory: is OK by default
        • Command arguments: should be "clean"
    • Under Run Settings
      • Set Executable: to "./build/examples/tutorial/ns3-dev-first-debug" or any executable you want to run and debug
        • If you set it to "examples/tutorial/first" make sure you used "--enable-examples" option in "./waf configure" prior to running the code
      • Leave Arguments: blank
      • Working directory: is again OK by default

FAQ

  • Q: I get an error "./build/examples/tutorial/ns3-dev-first-debug: error while loading shared libraries: libns3-dev-point-to-point-debug.so: cannot open shared object file: No such file or directory".
    • A: Please make sure that you are running "qtcreator" inside "./waf shell".