2026-01-14 6:30 AM
I had a Windows account with a space in user folder name (between forename and surname). VScode was installed under AppData subfolder. As a result CMake generated paths like this into compile_commands.json:
"command": "C:\\Users\\MIKKLE~1\\AppData\\Local\\STM32C~1\\bundles\\GNU-TO~2\\1431_S~1.2\\bin\\AR19DD~1.EXE -DDEBUG....
Most of the things worked (compiling and debugging), but vscode highlighted that it can't find includes like these:
#include <stdio.h>
#include <assert.h>
To be correct, clangd language server couldn't find them. Absence of these headers caused further errors. But when resolving other headers like stdint.h, clangd found them from st-arm-clangd bundle folder instead of compiler folder.
The workaround was to add the very same shortened path as query driver into .vscode\settings.json:
"--query-driver=C:\\Users\\MIKKLE~1\\AppData\\Local\\STM32C~1\\bundles\\GNU-TO~2\\1431_S~1.2\\bin\\AR19DD~1.EXE"
It solved the clangd issue temporarily until ST tools rewrote settings.json.
I thought it's the classical long path issue, but enabling long paths in Windows registry and forcing CMake to use longer paths (512 characters) did not solve it.
After removing space from my Windows user folder it started working normally.
Quick guide: Create temporary admin user, reboot, login with new user, rename user folder and update it in registry path HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList. Expect trouble with some applications.
I don't know whether it should be solved in CMake, clangd, ST vscode toolset or just made as an installation time warning. I hope ST team decides. So far maybe it helps somebody with the same issue.
2026-02-16 12:39 AM
@Mikk Leini
Thank you for the exhaustive report.
I have reproduced the issue. I am unsure about the workaround. We will investigate further.
2026-02-16 11:07 PM
Try Long Path Tool.
2026-02-16 11:17 PM
Try Long Path Tool. Thanks.
2026-02-19 7:58 AM
Here I found a pretty good explanation of what is happening:
https://github.com/clangd/clangd/issues/1518#issuecomment-1445647536
In conclusion,
In the meantime, let me post again 2 valid workarounds for future readers:
OR
Hopes this helps clear things up,
MNA
2026-03-04 10:32 PM
The same thing happens for me on MacOS. Clang was not resolving standard libraries like stdint.h and would direct the definition to the xcode gcc compiler instead of the stm32 version. I did the same fix as above and copied over the compile_commands path into query driver in settings.json and it fixed it.
The vscode compiler bundles get installed into the "/Users/USERNAME/Library/Application Support/stm32cube/bundles/gnu-tools-for-stm32/" directory by default, which has a space in it.
Is there a way to change the default bundle directory to one without a space? I can see the environment variables when i run "cube --help" from the project directory but I'm not sure how to change it.
Environment variables:
CUBE_BUNDLE_PATH -- Override local bundle repository location (/Users/USERNAME/Library/Application Support/stm32cube/bundles)
CUBE_BUNDLE_PATH_EXTRA -- Include extra bundles in addition to installed ones (is searched recursively)
CUBE_BUNDLE_REGISTRY -- URL to the online cube bundle registry
CMSIS_PACK_ROOT -- Path to CMSIS Pack storage (/Users/USERNAME/Library/Application Support/stm32cube/packs)
CUBE_CACHE_PATH -- Path to cache storage (/Users/USERNAME/Library/Caches/stm32cube)
CUBE_LOG_PATH -- Path to log storage (/Users/USERNAME/Library/Application Support/stm32cube/logs)
CUBE_NETWORK_MAX_REDIRECT -- Max number of redirect to follow (10)
CUBE_NETWORK_RETRY -- Number of retry attempts (5)
CUBE_NETWORK_TIMEOUT -- Timeout for network accesses (7200000ms)2026-03-05 12:57 AM
you can change it in command line with:
cube --set cube_bundle_path <path>and check:
cube --get-current-value cube_bundle_path
MNA
2026-03-08 10:02 PM
Perfect, this fixed everything and now the settings don't get overwritten. Thanks!