Arduino library broken in PlatformIO

‘Map’ is a dependancy of Arduino.h. My include Arduino.h has a squiggle under it, because ‘map’ can’t be located?

This is a conspiracy to frustrate me with libraries before I can get to the good stuff.

I am writing a Blink program. Here’s the error:

In file included from C:\Users\joema\.platformio\lib\ArduinoFake\src\ArduinoFake.cpp:1:0:
C:\Users\joema\.platformio\lib\ArduinoFake\src\ArduinoFake.h:7:15: fatal error: map: No such file or directory
compilation terminated.
In file included from C:\Users\joema\.platformio\lib\ArduinoFake\src/Arduino.h:1:0,
                 from src\main.cpp:1:
C:\Users\joema\.platformio\lib\ArduinoFake\src/ArduinoFake.h:7:15: fatal error: map: No such file or directory
In file included from C:\Users\joema\.platformio\lib\ArduinoFake\src\ClientFake.cpp:1:0:
C:\Users\joema\.platformio\lib\ArduinoFake\src\ArduinoFake.h:7:15: fatal error: map: No such file or directory
compilation terminated.
compilation terminated.
*** [.pio\build\uno\src\main.cpp.o] Error 1
*** [.pio\build\uno\lib9b9\ArduinoFake\ArduinoFake.cpp.o] Error 1
*** [.pio\build\uno\lib9b9\ArduinoFake\ClientFake.cpp.o] Error 1
In file included from C:\Users\joema\.platformio\lib\ArduinoFake\src\FunctionFake.h:3:0,
                 from C:\Users\joema\.platformio\lib\ArduinoFake\src\FunctionFake.cpp:1:
C:\Users\joema\.platformio\lib\ArduinoFake\src\fakeit/fakeit.hpp:14:22: fatal error: functional: No such file or directory
compilation terminated.
*** [.pio\build\uno\lib9b9\ArduinoFake\FunctionFake.cpp.o] Error 1
==============================================================================

I mean, if the Arduino library is actually broken, I guess nobody can use it?

Please fix it.

I created a new Projects folder.

You’re using the ArduinoFake library though. This is a mocking is a library for mocking Arduino APIs to be able to execute Unit Tests (GitHub - FabioBatSilva/ArduinoFake: Arduino mocking made easy).

You have installed this library globally and thus this library provides Arduino.h and is picked up by PlatformIO when it analyzes the header files in a program. This is fatal – this fake library should not be used in a normal firmware, but the Arduino.h from the underlying Arduino core.

The LDF docuemtation Library Dependency Finder (LDF) — PlatformIO latest documentation provides docs on the library system; you should try and use per-project local dependency management via lib_deps without global libraries, so that you only pull in those libraries needed for each and every project.

1 Like

I don’t have ArduinoFake anywhere. It’s not included, and I don’t have any files or folders with that name.

The above error mesage tells you the exact path where ArduinoFake is stored

And it’s included via #include <Arduino.h> since that is a part of the library

So the fix procedure is just as I have described above, by removing the library from the global library storage.

If I want to use an Arduino Framework, I need Arduino.h. It must be included.

Why is the Fake allowed to exist in the directory if its purpose is to foil the directory?

Never mind that. Does this mean that any Arduino work on PlatformIO is forever screwed, because of this contaminant library file?

ArduinoFake implements a Faking / Mocking framework for Arduino which is important for unit-testing code on e.g. PC against Arduino APIs without running on an Arduino, so it has very much a reason to exist for advanced use cases like these. Mock object - Wikipedia

If you remove this globally installed library again and only use lib_deps = ArduinoFake in projects where you need it there’s no problem.

Thank you, I learned a lot about libraries in PlatformIO.