7 years, 4 months ago.

Cannot compile!


I just down loaded the program "LPC331_Hello_World" with the library of "LPS331_I2C.cpp" and "LPS331_I2C.h", but I cannot compile the program. The error message says below;

Error: Cannot open source input file "device.h": No such file or directory in "extras/mbed_a9913a65894f/platform.h", Line: 21, Col: 21

How could I fix the problem?


Question relating to:

1 Answer

7 years, 4 months ago.

Hi Hitotsu,

  1. Open the example program in the IDE
  2. Click the "mbed" library in the navigation pane
  3. Click the "Update" button in the right/sidebar panel.
  4. Recompile!

You might have to change the pins in main.cpp.



Why do changes to the build system keep breaking projects that are tied to specific Mercurial revisions of mbed?

This has happened to me twice now as well.


posted by Max Vilimpoc 28 Jul 2016

This has just happened to me, and it is effecting 10 of my projects. My problem is that i don't have an option to update as i am using an old library for the NRF51-DK. How does one go about finding out what changes have occurred in mbed to cause these problems?

posted by James Cannan 28 Jul 2016

Lots of stuff has just broken for me too (using nRF51822).

Really a bit problematic for me right now...

I think the devs must be prepping for the big official switch to mbedOS now.

posted by CJ Shaw 28 Jul 2016

Max, James, can you provide me with example programs that compiled before and that are now failing to compile?

posted by mbed official 28 Jul 2016

The code that i have published on my repository no longer compiles: https://developer.mbed.org/users/Cannonball2134/code/

posted by James Cannan 28 Jul 2016

James, I just imported https://developer.mbed.org/users/Cannonball2134/code/I2C_Scanner/ and compiled it successfully for the nRF51822 mkit. What platform are you compiling for and am I missing something?

posted by -deleted- 28 Jul 2016

Hi Mihail,

Thank you for your prompt reply. The error message regarding "device.h" is solved by following your advice. Thank you. But the target still does not working well. Maybe pin configuration in main.cpp is wrong though I think I changed it correctly. I will continue to try fixing.

posted by Hitotsu A 29 Jul 2016

I tried this on the NRF51 Development Kit (PCA10028) using the I2C_Scanner code, and i still get the Error: Cannot open source input file "device.h": No such file or directory in "mbed-src-nrf51822/api/platform.h", Line: 21, Col: 21

posted by James Cannan 29 Jul 2016

Anyone figured out how to fix this problem yet?

posted by James Cannan 29 Jul 2016