Do I have to build whole ns3 every time I write new script for running

308 views
Skip to first unread message

Abud Sarami

unread,
Mar 27, 2023, 8:40:42 AM3/27/23
to ns-3-users
Hello dear friends.

I am new to ns3 I have probably very simple question and I was searching for a solution whole day but still haven't found solution that works.

So, I very well understand some cc files with example, but when I try to write my own similar example (that is correct) and try to run it with ./ns3 run command, I get something like this:

Traceback (most recent call last):
  File "./ns3", line 1629, in <module>
    main()
  File "./ns3", line 1566, in main
    raise Exception("Couldn't find the specified program: %s" % target_to_run)
Exception: Couldn't find the specified program: examples/wireless/newexample.cc.

Also, even if I copy existing script file anywhere, including scratch folder, I'm not able to simple run my script but I have to build whole ns3, which take some time. Also, when I try --no-build, still same output.

Please help, I haven't found similar theme or answer to this question - how to run new cc scripts?

Thank you a lot!

Abud Sarami

unread,
Mar 27, 2023, 8:50:36 AM3/27/23
to ns-3-users
And forgot to mention that existing ns3 examples and example scripts are working just fine.

Tom Henderson

unread,
Mar 27, 2023, 8:53:24 AM3/27/23
to ns-3-...@googlegroups.com
If you want to run 'newexample.cc' without making modifications to the CMake build files, place 'newexample.cc' in the scratch/ directory, and run it like this (without the '.cc' extension in the command name):

./ns3 run newexample

The build system should generally (there may be a few exceptions) compile and link whatever is necessary to complete the command.  If you pass the `--no-build` argument, then nothing will be compiled and the program will just look for existing executables in the build/ directory.

Please read the ns-3 tutorial, it discusses these things.

- Tom
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/5c338850-f382-411e-a651-c6e80b528b09n%40googlegroups.com.


Reply all
Reply to author
Forward
0 new messages