benjaminaheath
Posts: 5
Joined: Sun Jan 24, 2021 12:09 am

FIX: Ninja/CMake Can't Compile Examples on VS Code

Sun Jan 24, 2021 12:16 am

Hi friends, thought I'd make an account just to share this as I see a large number of others have been having this exact issue - CMake's default build generator uses a Ninja version which is bugged.

The solution I have found is to use NMake Makefiles as the generator; this is used in the shell earlier. It can be found under settings->CMake: Generator-> Enter into box NMake Makefiles.
cmake.png
Hope this helps someone else who has been hopelessly searching (like myself) online for a solution for a while...

GregAC
Posts: 52
Joined: Sun Aug 17, 2014 9:48 pm
Contact: Website

Re: FIX: Ninja/CMake Can't Compile Examples on VS Code

Sun Jan 24, 2021 11:38 am

Thanks for the fix, just trying to get the Pico SDK running under Ubuntu 18.04 LTS with VS Code and was having issues (couldn't build the examples as it complained it couldn't find pioasm which is meant to be found and built automatically when called for).

In my setup I had to use 'Unix Makefiles' as the setting.

To get it from VSCode go to File -> Preferences -> Extensions, click the gear on CMake Tools and choose 'Extension Settings' and scroll down to find the 'Cmake: Generator' setting.

It gives you a list of possible generators in the output if you put in a bad setting, so if neither 'NMake Makfiles' or 'Unix Makefiles' works for you take a look at the output and see what options are available and choose one.

TheYongGrand
Posts: 27
Joined: Sun Jan 25, 2015 1:20 am

Re: FIX: Ninja/CMake Can't Compile Examples on VS Code

Sun Jan 24, 2021 2:03 pm

It works, thanks! Should be sticky on top in case others are also encountering this issue. :)

QLister
Posts: 1
Joined: Mon Jan 25, 2021 7:46 am

Re: FIX: Ninja/CMake Can't Compile Examples on VS Code

Mon Jan 25, 2021 7:51 am

Lifesaver! I spent quite some time this weekend trying to resolve this. Many thanks!

hpwit
Posts: 2
Joined: Mon Jan 25, 2021 10:20 am

Re: FIX: Ninja/CMake Can't Compile Examples on VS Code

Mon Jan 25, 2021 10:22 am

Hello
I. ma running Vscode under M1 Mac OS X
I cannot fin any generator under Cmake:Generator how do I install Nmake
thank you

hpwit
Posts: 2
Joined: Mon Jan 25, 2021 10:20 am

Re: FIX: Ninja/CMake Can't Compile Examples on VS Code

Mon Jan 25, 2021 10:35 am

Hello
I am running VScode under MaCOS M1 and I cannot find the NMake for generator it stays blank
Any idea ?
thank you

kilograham
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 634
Joined: Fri Apr 12, 2019 11:00 am
Location: austin tx

Re: FIX: Ninja/CMake Can't Compile Examples on VS Code

Mon Jan 25, 2021 1:55 pm

try "Unix Makefiles"

User avatar
nick.mccloud
Posts: 1228
Joined: Sat Feb 04, 2012 4:18 pm

Re: FIX: Ninja/CMake Can't Compile Examples on VS Code

Mon Jan 25, 2021 2:24 pm

hpwit wrote:
Mon Jan 25, 2021 10:22 am
Hello
I. ma running Vscode under M1 Mac OS X
I cannot fin any generator under Cmake:Generator how do I install Nmake
thank you
You don't need to on macOS - this refers to a Windows issue. But I'll go away and double check on a fresh machine as my machines have CMake on them already.
Pico/RP2040 ≠ Arduino
Pico = hot rod kit car, Arduino = hot rod kit car wrapped in cotton wool with buoyancy aids & parachute

User avatar
nick.mccloud
Posts: 1228
Joined: Sat Feb 04, 2012 4:18 pm

Re: FIX: Ninja/CMake Can't Compile Examples on VS Code

Mon Jan 25, 2021 2:25 pm

Detailed info on Windows install here:

viewtopic.php?f=144&t=300189
Pico/RP2040 ≠ Arduino
Pico = hot rod kit car, Arduino = hot rod kit car wrapped in cotton wool with buoyancy aids & parachute

Return to “SDK”