Unable to build in Visual Studio Code #5
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk#5
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I followed the instructions in the PDF and successfully setup Windows to build from the command line. However when trying to build from VSC it reports the following error:
[main] Building folder: pico-examples
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/barry/Downloads/pico-examples/build --config Debug --target all -- -j 8
[build] ninja: error: FindFirstFileExA(c/:/users/barry/downloads/pico-sdk/src/rp2_common/boot_stage2): The filename, directory name, or volume label syntax is incorrect.
[build]
[build] Build finished with exit code 1
If I paste the same command line into a VS cmd box it reports the same issue. This also happens if I select build all or a specific code set e.g. blink
I think there is a problem with the ninja CMake generator and pico-examples, can you try setting "NMake Makefiles" as the preferred/default build generator in CMake plugin settings?
'nmake' is not recognized as an internal or external command,
operable program or batch file.
I follow the instructions in pdf running on Windows. All good until trying to run nmake.
D:\2021\RpiPico\pico-examples\build>cmake -G "NMake Makefiles" ..
Using PICO_SDK_PATH from environment ('....\pico-sdk')
Pico SDK is located at D:/2021/RpiPico/pico-sdk
Defaulting PICO_PLATFORM to rp2040 since not specified.
Defaulting PICO platform compiler to pico_arm_gcc since not specified.
-- Defaulting build type to 'Release' since not specified.
PICO compiler is pico_arm_gcc
PICO_GCC_TRIPLE defaulted to arm-none-eabi
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- The ASM compiler identification is GNU
-- Found assembler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2020-q4-major/bin/arm-none-eabi-gcc.exe
Defaulting PICO target board to pico since not specified.
Using board configuration from D:/2021/RpiPico/pico-sdk/src/boards/include/boards/pico.h
-- Found Python3: C:/Python38/python.exe (found version "3.8.7") found components: Interpreter
TinyUSB available at D:/2021/RpiPico/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; adding USB support.
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
ELF2UF2 will need to be built
PIOASM will need to be built
-- Configuring done
-- Generating done
-- Build files have been written to: D:/2021/RpiPico/pico-examples/build
D:\2021\RpiPico\pico-examples\build>nmake
'nmake' is not recognized as an internal or external command,
operable program or batch file.
you need to run it from a visual studio developer command prompt (or whatever it is called)
Thanks a lot. It works. You save me a lot of time and headaches. I still have to figure out how to use VSCode. Is it possible to use J-Link for debugging on Windows?
Excellent, that fixed it, many thanks kilograham :). So for everyone else, you need to add the "NMake Makefiles" to the Settings tab of the extension under the entry labelled:
Cmake: Generator
The CMake generator to use
Should look like this

Also if you are using VS Code on something other than Windows you likely need to change this to "Unix Makefiles"
I've now updated the documentation to reflect this, will be available in the next docs release expected today.
You may also have to specify not to skip installing the Windows 10 SDK from VS build tool installation step. Because not installing the SDK will cause NMAKE to fail. Installing the Windows 10 SDK solved an error I encountered later.
Just for the sake of completeness (not that it really matters, because our instructions say to use
nmake), but it turns out that the problem withninjais that GCC outputs dependency-information in a slightly-incorrect format thatninjacan't understand.https://gitlab.kitware.com/cmake/cmake/-/issues/21997#note_929924
EDIT: ...which in turn has been fixed in the
masterversion ofninja, https://github.com/ninja-build/ninja/pull/1774 but seems like it isn't yet included in a released-version of ninja.I'll add a note to the Getting Started book to this effect.
The fix for ninja-build/ninja#1774 are included in ninja release 1.10.1 and later