Project suddenly can't find Arduino.h but all lip_deps build


A project that I have been working on has lost the ability to find Arduino.h, after a clean all the libraries build find but main.cpp fails on the include of <Arduino.h>


platform = atmelsam
board = mkrzero
framework = arduino
lib_deps =

platform = atmelsam
board = mkrzero
extra_scripts =


#include <Arduino.h>


#include <Arduino.h>
compilation terminated.
*** [.pio\build\pre_and_post_hooks\src\main.o] Error 1

Cannot remember changing anything and looks like all my other still working projects, any ideas?

Clean and build does not resolve it,



The error message is from building the pre_and_post_hooks configuration. This configuration does not specify any framework. So it is to be expected that Arduino.h is not found.

You either want to:

  • add framework = arduino to the env:pre_and_post_hooks section, or
  • build mkrzero configuration instead.
1 Like

Thanks, that fixed it, long delay while tackled other issues from boards and non Platform io!

Its not clear to me in the build log how to tell what stage its on, and also given that the pre/post stage is nit compiling why I get compile errors, these to not end up in the problem log window so are harder to quickly track down,

anyways back to getimg this going and switching board platforms…

thanks again


1 Like

You have two build environments declared, mkrzero and pre_and_post_hooks. Given the path in the error message ‘.pio\build\pre_and_post_hooks\src\main.o’ … the error was in relation to the pre_and_post_hooks environment. :wink:

The other way to tell is to look at what environment is listed at the top of the latest build - e.g.

If you primarily only want to compile one environment, and not always build both of them, have a look at the default_envs parameter, which will let you build only the specified environments when you hit the ‘build all’ option.