nRF52-DK - "platform.h" not found

When compiling a simple mBed OS2 example for the nRF52-DK, I get the following error:

Error: Cannot open source input file “device.h”: No such file or directory in “extras/mbed/platform/platform.h”, Line: 29, Col: 21

According to this page: Compiler Error 5 - Cookbook | Mbed - it is because the mbed library version does not support this board.

However according to the platforms page - Development boards | Mbed - it does. What gives?

Hi Tim,

Are you using a public example with the Online Compiler? If so - which is it? It’s possible that the example is so old that it pre-dates support for the nRF52-DK. You can try selecting “mbed” in the project (in the left-side Program Workspace) and then right-click to “Update” the version of Mbed in the project. That might fix the problem.

If you are building from the command line (with Mbed CLI), could you send us the steps to recreate the problem? Perhaps you don’t have a valid Mbed project. Mbed OS2 projects can be a little quirkly with the CLI, especially if you have an older version. You can check the version you are using with “mbed --version”.

Regards,
Ralph, Team Mbed