Resolved: Fatal error: memory: No such file or directory

I am attempting to compile a simple program for a NodeMCU, using the Arduino framework, that includes the SPIFFS library. I have deleted ATOM and removed all traces of PlatformIO that I could find and reinstalled, but no matter what I try I always get the same error:

In file included from src/my_main.c:1:0:
/Users/gschu/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/FS.h:24:18: 
fatal error: memory: No such file or directory

#include <memory>
^
compilation terminated.

As a test I reduced my code file to the minimum need to reproduce the error, and it is:

#include <FS.h>

What am I missing? Where should it find the required library?

Additional (relevant?) info…

Mac OS X: 10.11.6 (15G1004)
ATOM 1.9.9
PlatformIO IDE 1.6.0
PlatformIO CLI 3.1.0

The only platform installed:

~/Documents/pio_test2 gschu> pio platform list
espressif8266 ~ Espressif 8266
==============================
Espressif Systems is a privately held fabless semiconductor company. They provide wireless communications and Wi-F
i chips which are widely used in mobile devices and the Internet of Things applications.

Home: http://platformio.org/platforms/espressif8266
Packages: framework-arduinoespressif8266, tool-esptool, toolchain-xtensa
Version: 1.1.3

The project’s platform.ini file is as follows:

[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino

Complete build output:

[Mon Oct 17 12:03:19 2016] Processing nodemcuv2 (platform: espressif8266, board: nodemcuv2,
 framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Collected 23 compatible libraries
Looking for dependencies...
Project does not have dependencies

Compiling .pioenvs/nodemcuv2/src/my_main.o
Archiving .pioenvs/nodemcuv2/libFrameworkArduinoVariant.a
Indexing .pioenvs/nodemcuv2/libFrameworkArduinoVariant.a
In file included from src/my_main.c:1:0:
/Users/gschu/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/FS.h:24:18: 
fatal error: memory: No such file or directory
#include <memory>
^
compilation terminated.
Compiling .pioenvs/nodemcuv2/FrameworkArduino/Esp.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/FS.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/HardwareSerial.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/IPAddress.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/MD5Builder.o
*** [.pioenvs/nodemcuv2/src/my_main.o] Error 1
Compiling .pioenvs/nodemcuv2/FrameworkArduino/Print.o
========================== [ERROR] Took 0.69 seconds ==========================

Could you try rm -rf ~/.platformio and re-build project?

Thank you for the quick reply…

Actually, I tried that but failed to mention it. Sorry. For good measure, I just now quit ATOM, deleted the ~/.platformio directory, restarted ATOM and clicked the Build icon. Below is the output:

********************************************************************************
If you like PlatformIO, please:
- follow us on Twitter to stay up-to-date on the latest project news > https://twitter.com/PlatformIO_Org
- star it on GitHub > https://github.com/platformio/platformio
- support us with PlatformIO Plus > https://pioplus.com
********************************************************************************
 

[Mon Oct 17 13:30:28 2016] Processing nodemcuv2 (platform: espressif8266, board: nodemcuv2, framework: arduino)
--------------------------------------------------------------------------------
PlatformManager: Installing espressif8266
Downloading...
Unpacking...
espressif8266 @ 1.1.3 has been successfully installed!
The platform 'espressif8266' has been successfully installed!
The rest of packages will be installed automatically depending on your build environment.
PackageManager: Installing toolchain-xtensa @ ~1.40802.0
Downloading...
Unpacking...
toolchain-xtensa @ 1.40802.0 has been successfully installed!
PackageManager: Installing tool-esptool @ ~1.409.0
Downloading...
Unpacking...
tool-esptool @ 1.409.0 has been successfully installed!
PackageManager: Installing tool-scons @ >=2.3.0,<2.6.0
Downloading...
Unpacking...
tool-scons @ 2.4.1 has been successfully installed!
PackageManager: Installing framework-arduinoespressif8266 @ ~1.20300.1
Downloading...
Unpacking...
framework-arduinoespressif8266 @ 1.20300.1 has been successfully installed!
Verbose mode can be enabled via `-v, --verbose` option
Collected 23 compatible libraries
Looking for dependencies...
Project does not have dependencies
Compiling .pioenvs/nodemcuv2/src/my_main.o
In file included from src/my_main.c:1:0:
/Users/gschu/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/FS.h:24:18: fatal error: memory: No 
such file or directory
#include <memory>
^
compilation terminated.
Compiling .pioenvs/nodemcuv2/FrameworkArduino/Schedule.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/Stream.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/StreamString.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/Tone.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/Updater.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/WMath.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/WString.o
*** [.pioenvs/nodemcuv2/src/my_main.o] Error 1
========================== [ERROR] Took 19.74 seconds ==========================

Does it work with Arduino IDE?

If I change the file extension to uno, rename the folder to match the filename (my_main) and add empty setup() and loop() functions then it compiles in the Arduino IDE without error.

Resulting test file my_main.ino:

#include <FS.h>

void setup() {
}

void loop() {
}

Please sorry, I’ve not seen before your mistake. You are going to use C++ code in “C” file. That is not possible. Please rename my_main.c to my_main.cpp`.

That resolved the issue. Changing the name of the file from my_main.c to my_main.cpp resulted in a successful build. As a side note, changing the name to my_main.ino also resulted in a successful build.

For others who may experience the same or similar issue, please note that the same applied to my libraries. In the folder structure below, despite the fact that the .cpp files only contain C code they both must have the .cpp extension. Changing either of them to .c results in the error described at the start of this thread.

my_project
  lib
    my_lib
      my_lib.cpp
      my_lib.h  <- contains #include <FS.h>
  src
    my_app.cpp  <- contains #include "my_lib.h"

Thank you for your speedy assistance.

An Arduino-minded developer venturing into the world of C and C++.

Happy Coding with PlatformIO! :blush: