Description
TL;DR - the .vs-code/cmake-kits.json
, compilers
-> CXX
value seems incorrectly set by default. It picks gcc.exe, not the g++ exe as the C++ compiler.
This seems easy enough to replicate: On Windows, create a project from the "blink" example, I chose SDK 1.5.1 and left the settings as default. This was on a Windows PC that had never have VS Code or Pico SDK on it before.
This resulted in a .vs-code/cmake-kits.json
file like this:
[
{
"name": "Pico",
"compilers": {
"C": "${userHome}/.pico-sdk/toolchain/13_2_Rel1/bin/arm-none-eabi-gcc.exe",
"CXX": "${userHome}/.pico-sdk/toolchain/13_2_Rel1/bin/arm-none-eabi-gcc.exe"
},
"toolchainFile": "${env:USERPROFILE}/.pico-sdk/sdk/1.5.1/cmake/preload/toolchains/pico_arm_gcc.cmake",
"environmentVariables": {
"PATH": "${command:raspberry-pi-pico.getEnvPath};${env:PATH}"
},
"cmakeSettings": {
"Python3_EXECUTABLE": "${command:raspberry-pi-pico.getPythonPath}"
}
}
]
From some research, this may be related to the cmake plugin explicitly looking for a binary called "g++". ARM have prefixed the binary name with "arm-none-eabi-". Ref: https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/kits.md#scan-for-kits
This incorrect config probably doesn't cause an issue with the blink example, but it did cause an issue with the project I was trying to work with that used C++: the build step failed at link time with various errors related to missing std c++ lib internal functions.
Related side notes (possibly separate issues):
- The project I was using also required that I switch to using the cmake plugin as it had various unusual cmake aspects. I noticed that when I changed the SDK version then the
toolchainFile
value would not update the path, i.e. it would still referencesdk/1.5.1
after switching to 2.0.0 (though the other settings in the file and elsewhere would update). - After deleting the .vscode directory and reimporting the project to point at SDK 2.0.0 from the import, I noticed that it still tried to use
cmake/preload/toolchains/pico_arm_gcc.cmake
for the toolchainFile. AIUI, the names under 2.0.0 are slightly different, I assume because of the new Pico 2 ARM cores and RISC-V cores - so, I don't think that will work (if it's used).