Skip to content

VS Code Setup

Toya Takahashi edited this page Jan 25, 2025 · 6 revisions

It is recommended that you use VS Code for your IDE.

Recommended extensions

IntelliSense (code completion)

By default, code completion doesn't work well for C++ with ROS, especially with custom messages, and you will likely see many red squiggles. To fix this, first run colcon build again with an extra flag:

colcon build --symlink-install --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

The extra flag generates a compile_commands.json inside your build folder which can be used to configure IntelliSense.

Then, add the following line to configurations of c_cpp_properties.json, which should be located inside your .vscode folder.

"compileCommands": "~/arcturus/dev_ws/build/compile_commands.json"

Here is an example c_cpp_properties.json:

{
    "configurations": [
        {
            "browse": {
                "databaseFilename": "${default}",
                "limitSymbolsToIncludedHeaders": false
            },
            "name": "all_seaing_vehicle",
            "intelliSenseMode": "gcc-x64",
            "cStandard": "gnu11",
            "cppStandard": "c++14",
            "compileCommands": "~/arcturus/dev_ws/build/compile_commands.json"
        }
    ],
    "version": 4
}
Back: Native Installation or Docker Installation Top: Installation