Skip to content

Configuring Visual Studio Code for ns-3 Under chroot Jail

Visual Studio Code (VS Code) is an open-source source-code editor made by Microsoft for Windows, Linux and macOS[1]. It has the support for debugging, syntax highlighting, intelligent code completion, snippets, code refactoring, embedded Git and having rich and freely available extensions. Since I am using VS Code under chroot jail, we need to setup chroot jail and install VS Code as well  as ns-3 under that chroot jail.

If you’re  not yet installed VS Code and ns-3, then you may complete the installation using the following two  procedures.

In the following article, we already mentioned the way of setting up a chroot jail and explained the advantages of installing ns-3 under chroot based environment.

Installing ns3.35 in Debian 10 chroot Jail Under Debian 11 Host OS or any Version of Linux Host

VS Code is available from the official Apt repositories of Microsoft. We can download it and install it under Debian as explained below. I just followed the procedure presented in [3] – but I customized that procedure for installing it under chroot jail.

The following procedure explains the way of installing VS Code under Debian 10 chroot jail.

Installing VS Code under chroot and configuring it for ns-3


Sorry!!!. Some sections are hidden; because, you are only having restricted access to this article.

While getting paid support/assistance for your research from Charles, you may get an access key/password to some articles. If you are having the access key/password to this particular article, then please enter it below to unlock the restricted section of this article.

If your research is related to this area, and you want to get paid support/assistance from Charles, then you may start a 'free' research discussion with Charles.


The following screenshot shows a typical default VS Code GUI:

Configuring VS Code for ns-3.

I closely followed the configuration proceeded presented in [4].

The following steps explains the way in which we can install ns-3, VS Code under chroot-jail and how we can configure VS Code to do development on ns-3 using CMake.

Step 1:Installing Necessary Plugins for ns-3

We can install some important extensions that are necessary for working with ns-3. This can be done using the “Plugins” button from the left side vertical panel of selecting the appropriate option from the top menu.


Two important plugins needed for working with ns-3 are : CMake and C++ plugins.

From the following screenshot, you can see the versions of the newly installed plugins.


Step 2: Configuring VS Code for ns-3 Project

If you want to install the dev version of ns-3, then you may follow the following procedure:

Installing ns-3-dev Under chroot Jail and Compile with CMake

If you are selecting the previously installed ns-3.35 or ns-3-dev folder, then mostly, it will be ready to run it using CMake.

The following screenshot shows the ns-3-dev folder opened under VS Code editor.

Opening  “C/C++ Edit Configurations UI”

Now we have to edit some C/C++ configurations using a UI. The following screenshot shows the way to open the “C/C++: Edit Configurations (UI)” by pressing “Ctrl+Shift+P” key and selecting the “C/C++: Edit Configurations (UI)” option from the list.

The  “C/C++ Edit Configurations UI”

In the opened configuration editor, Edit/insert the “include paths”. We have to include the important  include path to “ns3” folder, where all the header files are kept after compilation. In the new ns-3-dev, it is kept under the folder ~/ns-3-dev/build/include/ns3 – so we have to include a path ${workspaceFolder}/build/include/ under which the folder “ns3” exists.

Of course, we may need to include the paths of other compiled binaries and other custom headers also.  It may be done as per the requirement. But, after including the path “${workspaceFolder}/build/include/ “, ns-3-dev is ready to use under VS Code Editor. The  features such as IntelliSense and debugging will work correctly – so that we can start our development under VS Code Editor.


  2. Installing ns3.35 in Debian 10 chroot Jail Under Debian 11 Host OS or any Version of Linux Host


For Assistance in Protocol Implementation, Simulations & Analysis of Industrial as well as Scholarly Research Works, you may Contact Us.

WhatsApp chatDiscuss Through WhatsApp

Call 91 9843779735

Send an e-Mail Message.

This site is protected by reCAPTCHA and the Google
Privacy Policy and
Terms of Service apply.

WhatsApp Discuss Through WhatsApp