Skip to content

Work with VS Code

Visual Studio Code (VS Code) is a popular code editor which can be customized by extensions (plug-ins). Since Artery is mostly a plain C++ project using CMake as its build tool, one can use VS Code instead of the Eclipse-based OMNeT++ IDE for development.


Install VS Code along with its C/C++ and CMake Tools Extensions.

Building and Running Simulations

First, open Artery's folder with VS Code. Press Ctrl+Shfit+P to execute the following commands: 1. CMake: Scan for Kits 2. CMake: Select a Kit to select a compiler kit (GCC/Clang) 3. CMake: Set Build Target and choose your scenario (in doubt: run_example) 4. CMake: Build to start the simulation

Debugging Simulations

  1. Add launch.json to .vscode/. Adjust paths and arguments to your system/needs:
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit:
    "version": "0.2.0",
    "configurations": [
            "name": "clang++ - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",

            // Set path to OMNet++ debug runner
            "program": "<path>/omnetpp-5.6.2/bin/opp_run_dbg",

            // Set working directory to scenario
            "cwd": "${workspaceFolder}/scenarios/artery",

            "environment": [
                { "name": "ARTERY_HOME", "value": "<path>" },
                { "name": "OMNETPP_HOME", "value": "<path>" },
                { "name": "OMNETPP_ROOT", "value": "<path>" },
                { "name": "SUMO_HOME", "value": "<path>" }
            "args": [
                // Paths to NED files

                // Libraries used for Artery
                // "-l${ARTERY_HOME}/build/scenarios/highway-police/",

                // .ini file to of the scenario

                // OMNet++ config to run
                // Run number

                // OMNet++ interface can either be Qtenv or Cmdenv
            "stopAtEntry": false,
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                    "description": "Enable all-exceptions",
                    "text": "catch throw",
                    "ignoreFailures": true
            "preLaunchTask": "C/C++: clang++ build active file",
            "miDebuggerPath": "/usr/bin/gdb"
  1. Add tasks.json to .vscode/
    "tasks": [
            "type": "cppbuild",
            "label": "C/C++: clang++ build active file",
            "command": "/usr/bin/cmake",
            "args": [
                "--parallel 6"
            "options": {
                "cwd": "${workspaceFolder}/build"
            "problemMatcher": [
            "group": {
                "kind": "build",
                "isDefault": true
            "detail": "Generated task by Debugger"
    "version": "2.0.0"
  1. Execute CMake: Select Variant and select Debug
  2. In case of doubt: execute CMake: Clean Rebuild
  3. Switch to debug view with Ctrl+Shift+D
  4. Start debugging by pressing F5


Thanks to Alexander Willecke for contributing this page.

Last update: October 26, 2022