0

3 and hope this question is not too stupid... I'm recently using ns-3 and try to compile the codes. I found that I don't need to explicitly specify compilation, instead, using

./waf --run someCode.cc

will first compile and code and then execute it. My question is, I'm trying to compile/run the code in a deeper folder. To be precise, I want to execute one example code located in

<ns-3.22>/src/lte/example/lena-simple-epc.cc

but when I enter

./waf --run src/lte/example/lena-simple-epc

I just got the following message:

Waf: Entering directory `..../ns-allinone-3.22/ns-3.22/build'
program 'src/lte/examples/lena-simple-epc' not found; available programs are: [...]

But, if I copy the file src/lte/examples/lena-simple-epc.cc under the folder scratch and execute ./waf --run scratch/lena-simple-epc, then it works perfectly. Is this expected or did I miss any step? (Forgot to export some environment variables or something?)

TimeString
  • 1,778
  • 14
  • 25

1 Answers1

2

You don't need to specify all the path!

Just run:

./waf --run lena-simple-epc

If you are not secure on how to start a script just look at the wscript file in the examples folder and look for these rows.

obj = bld.create_ns3_program('lena-simple-epc',
                             ['lte'])
obj.source = 'lena-simple-epc.cc'

With lena-simple-epc you can start the script.

Idipaolo
  • 788
  • 5
  • 11
  • 1
    Thanks for the hint! I finally solved my problem. I'd like to provide a little bit more detail though. (a) I didn't execute this command `./waf configure --build-profile=debug --enable-examples --enable-tests` before and thus cannot execute example code. (b) `./waf --run` is executed under the ns-3 root folder and waf will automatically such the path. (c) The quoted code in the second block is under /src/lte/example/wscript. – TimeString May 05 '15 at 04:10