[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
We typically run scripts under the control of Waf. This allows the build
system to ensure that the shared library paths are set correctly and that
the libraries are available at run time. To run a program, simply use the
--run
option in Waf. Let’s run the ns-3
equivalent of the
ubiquitous hello world program by typing the following:
./waf --run hello-simulator
Waf first checks to make sure that the program is built correctly and executes a build if required. Waf then executes the program, which produces the following output.
Hello Simulator
Congratulations. You are now an ns-3 user.
What do I do if I don’t see the output?
If you don’t see waf
messages indicating that the build was
completed successfully, but do not see the “Hello Simulator” output,
chances are that you have switched your build mode to “optimized” in
the “Building with Waf” section, but have missed the change back to
“debug” mode. All of the console output used in this tutorial uses a
special ns-3
logging component that is useful for printing
user messages to the console. Output from this component is
automatically disabled when you compile optimized code – it is
“optimized out.” If you don’t see the “Hello Simulator” output,
type the following,
./waf -d debug configure
to tell waf
to build the debug versions of the ns-3
programs. You must still build the actual debug version of the code by
typing,
./waf
Now, if you run the hello-simulator
program, you should see the
expected output.
If you want to run programs under another tool such as gdb or valgrind, see this wiki entry.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated on April 21, 2010 using texi2html 1.82.