Skip to main content
Visitor II
July 13, 2025
Solved

Clangd IntelliSense issues: plugin-generated --query-driver incomplete for C++, and multi-lib-config triggers errors

  • July 13, 2025
  • 4 replies
  • 1999 views

I am using the STM32Cube VS Code extension (Preview) with the official ST-ARM-CLANG and clangd for code completion. Just ran into two issues:

1. Incomplete --query-driver config breaks C++ IntelliSense

The extension adds

--query-driver=${env:CUBE_BUNDLE_PATH}/st-arm-clang/19.1.6+st.8/bin/starm-clang.exe

to settings.json by default, but this is not enough for C++ files.
Unless you also add

--query-driver=${env:CUBE_BUNDLE_PATH}/st-arm-clang/19.1.6+st.8/bin/starm-clang++.exe

C++ IntelliSense will be broken (red squiggles, no symbols, etc).
Same issue for GCC toolchain: you need both gcc and g++ in the driver list.

2. --multi-lib-config triggers errors in clangd

If you enable --multi-lib-config, clangd just starts throwing errors about missing headers and stuff, even though the project still compiles fine.
Is this a known issue? Anyone have a workaround?

By the way, is there any official way to download the standalone ST Arm Clang toolchain (without the VSCode extension)?
It would be super useful for CI/CD or automation, similar to how STM32CubeCLT was distributed before.

Thanks!

    This topic has been closed for replies.
    Best answer by lconlcong

    To be honest, stm32cube-clangd's only job seems to be unconditionally reporting errors whenever it sees st-arm-clang options—even though these are perfectly valid for STM32. If you want real code completion, just use the regular clangd extension instead—at least it doesn't freak out over STM32's own toolchain.

    4 replies

    Graduate
    July 15, 2025

     

    Same here.
    I work with a VSCode workspace, and these settings are stored in the 'ProjectName.code-workspace' file.
    Unfortunately, VSCode deletes the following entry every time the workspace is opened:
    "--query-driver=${env:CUBE_BUNDLE_PATH}/st-arm-clang/19.1.6+st.8/bin/starm-clang++.exe".

    An entry with a wildcard is replaced after opening the workspace.
    "--query-driver=${env:CUBE_BUNDLE_PATH}/st-arm-clang/19.1.6+st.8/bin/starm-clang*".
    => no solution

    You can see this behaviour in the attached video.

    • Timecode 0:00
      A STM32CubeMx project with Cpp sources was compiled before the video is recorded with the
      '--query-driver=${env:CUBE_BUNDLE_PATH}/st-arm-clang/19.1.6+st.8/bin/starm-clang++.exe' entry without any issues.
    • Timecode 0:12 
      VS Code is closed.
    • Timecode 0:17 
      VS Code reopens by double-clicking the STM32Firmware.code-workspace file.
    • Timecode 0:29
      The entry is removed automatically.
    • Timecode 0:40
      CMake: Detele Cache an Reconfigure
    • Timecode 0:46
      CMake: Clean Rebuild
    • Timecode 0:57
      Still "No Problems" - but wait...
    • Timecode 1:02After opening a .cpp file, some problems appear, such as 'Unknown Compiler', and so on.

    Please provide a solution for this. Thanks!

     

    lconlcongAuthorAnswer
    Visitor II
    July 19, 2025

    To be honest, stm32cube-clangd's only job seems to be unconditionally reporting errors whenever it sees st-arm-clang options—even though these are perfectly valid for STM32. If you want real code completion, just use the regular clangd extension instead—at least it doesn't freak out over STM32's own toolchain.

    Graduate II
    July 22, 2025

    Except STM clangd extension sounds to be original one clone (per readme comment) just hacking it revisiting way to get clangd utility itself. Not sure moving back to original is helpful here. 

    What is your expérience so far doing it ?

    lconlcongAuthor
    Visitor II
    July 22, 2025

    Mainline clangd works better. It fully recognizes all st-arm-clang options and does not show any errors. Also, the settings are not messed up by STM32Cube plugin. I recommend just using official clangd.

    Graduate
    August 18, 2025
    ST Employee
    August 18, 2025

    Please be aware that stm32cube-ide-build-cmake-1.40.1.vsix has been released to address C++ concerns.