Skip to main content
Visitor
July 15, 2026
Question

VS Code Build Fails If Folder has Spaces

  • July 15, 2026
  • 4 replies
  • 78 views

I am using STM32CubeIDE for Visual Studio Code


If I create an empty project in a folder with spaces the build will fail. I suspect the spaces create a double quote somehow.

In the command below, main.c is wrapped in two quotes, -c ""C:\Users\me\VSC_projects\STM first try\asdf\Src\main.c""

I suspect this makes gcc look for a file named main.c” instead of main.c. Plus “C:\ instead of C:\

Failing build due to spaces:

C:\Users\me\AppData\Local\stm32cube\bundles\gnu-tools-for-stm32\14.3.1+st.2\bin\arm-none-eabi-gcc.exe -DDEBUG -DRTE_DEVICE_STARTUP_STM32H5XX "-I"C:/Users/me/VSC_projects/STM first try/asdf/Inc"" "-I"C:/Users/me/VSC_projects/STM first try/asdf"" -fdata-sections -ffunction-sections -Wl,--gc-sections -Wno-comment -g -std=gnu11 -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mlittle-endian -mthumb -fstack-usage -Wall -Wextra -Wpedantic -Wno-unused-parameter -O0 -g3 -ggdb -o CMakeFiles\asdf.dir\Src\main.c.obj -c ""C:\Users\me\VSC_projects\STM first try\asdf\Src\main.c""
arm-none-eabi-gcc.exe: warning: "C:\Users\me\VSC_projects\STM first try\asdf\Src\main.c": linker input file unused because linking not done
arm-none-eabi-gcc.exe: error: "C:\Users\me\VSC_projects\STM first try\asdf\Src\main.c": linker input file not found: Invalid argument
Compilation finished with error(s).
Press any key to close the terminal…

Successful build in a folder without spaces

C:\Users\me\AppData\Local\stm32cube\bundles\gnu-tools-for-stm32\14.3.1+st.2\bin\arm-none-eabi-gcc.exe -DDEBUG -DRTE_DEVICE_STARTUP_STM32H5XX -IC:/Users/me/VSC_projects/STM_no_space/myHello/Inc -IC:/Users/me/VSC_projects/STM_no_space/myHello -fdata-sections -ffunction-sections -Wl,--gc-sections -Wno-comment -g -std=gnu11 -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mlittle-endian -mthumb -fstack-usage -Wall -Wextra -Wpedantic -Wno-unused-parameter -O0 -g3 -ggdb -o CMakeFiles\myHello.dir\Src\main.c.obj -c C:\Users\me\VSC_projects\STM_no_space\myHello\Src\main.c
Compilation finished successfully.
Press any key to close the terminal...

 

4 replies

Andrew Neil
Super User
July 15, 2026

This is a universal issue - not specific VSCode or ST; eg,

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
workerAuthor
Visitor
July 15, 2026

VS Code can build from a file with spaces just fine with gcc as shown below.

The problem is unique to STM32CubeIDE for Visual Studio Code

Than you
 

Starting build...
cmd /c chcp 65001>nul && C:\msys64\ucrt64\bin\gcc.exe -fdiagnostics-color=always -g "C:\Users\me\VSC_projects\Space Success\hello.c" -o "C:\Users\me\VSC_projects\Space Success\hello.exe"

Build finished successfully.
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: C/C++: gcc.exe build active file 

Starting build...
cmd /c chcp 65001>nul && C:\msys64\ucrt64\bin\gcc.exe -fdiagnostics-color=always -g "C:\Users\me\VSC_projects\Space Success\hello.c" -o "C:\Users\me\VSC_projects\Space Success\hello.exe"

Build finished successfully.
 *  Terminal will be reused by tasks, press any key to close it.

ST Employee
July 15, 2026

@worker 

In CMake, special characters are not supported.

If CMake directives are adjusted, this support can be enabled. This behavior was supported in the past, but the decision was revised. The added CMake syntax is too complex for the limited benefit.

For now, the extension that creates an empty project must reject special characters, including spaces.
 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
workerAuthor
Visitor
July 15, 2026

The failing project’s name is “asdf”. The project was created in “STM first try”/.

Hence, the create project menu did not detect or avoid this issue.

If you chose not to support spaces I recommend updating the process to inspect the full project path.


Thank you.

ST Employee
July 15, 2026

@worker 

My bad. My comment referred to the project name, which includes a space character. The shared information shows the parent path of the project.

GCC supports this. STM32CubeIDE for Visual Studio Code supports this too.

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
workerAuthor
Visitor
July 16, 2026

Fascinating.

Could you share the terminal call to arm-none-eabi-gcc.exe?

 

Further testing shows the problem is unrelated to the “create empty project” feature.

The double quote issue appears when importing a STM32Cube project to a folder with a space.

The same project can be imported to a folder without spaces and compiles successfully.

Thank you

ST Employee
July 16, 2026

@worker 

Please could you detail more what means “importing a STM32Cube project to a folder” ?
What is exactly your workflow / menu(s) used ?
Thanks your reply I may try to help you the best.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.