Fatal error using WiFiManager.h

I am using the arduino-cli on a Raspberry Pi.
I have installed the esp8266 on in the board manager.
Using command: arduino-cli compile -b esp8266:esp8266:generic wifiman.ino -v
it runs through the notifications and then has this to say:
.../WiFiManager.h:23:10: fatal error: vector: No such file or directory
23 | #include

compilation terminated.

I can't find a vector library to install, Google hasn't shown me solutions. Help please!

vector is usually part of the Standard Template Library, which may not be shipped with the esp8266 core.

Maybe you could try to install the following library (I do not know whether it is fully compatible with the standard implementation) and include it before you include WiFiManager.h.

Otherwise, here are some instructions on how to install an implementation of the STL.

It is part of the toolchain, which will be installed along with the ESP8266 boards platform when you run the arduino-cli core install esp8266:esp8266 command

The file is located at this path:

<directories.data>/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/xtensa-lx106-elf/include/c++/10.3.0/vector

(where <directories.data> is configured in the Arduino CLI settings, which can be seen in the arduino-cli config dump output)

Here is a demo:

$ arduino-cli version
arduino-cli.exe  Version: 0.26.0 Commit: fc2ea723 Date: 2022-08-10T14:33:37Z

$ export ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS="https://arduino.esp8266.com/stable/package_esp8266com_index.json"

$ arduino-cli core update-index
Downloading index: package_index.tar.bz2 downloaded
Downloading index: package_esp8266com_index.json downloaded

$ arduino-cli core install esp8266:esp8266
Downloading packages...
esp8266:xtensa-lx106-elf-gcc@3.0.4-gcc10.3-1757bed already downloaded
esp8266:mkspiffs@3.0.4-gcc10.3-1757bed already downloaded
esp8266:mklittlefs@3.0.4-gcc10.3-1757bed already downloaded
esp8266:python3@3.7.2-post1 already downloaded
esp8266:esp8266@3.0.2 already downloaded
Installing esp8266:xtensa-lx106-elf-gcc@3.0.4-gcc10.3-1757bed...
esp8266:xtensa-lx106-elf-gcc@3.0.4-gcc10.3-1757bed installed
Installing esp8266:mkspiffs@3.0.4-gcc10.3-1757bed...
esp8266:mkspiffs@3.0.4-gcc10.3-1757bed installed
Installing esp8266:mklittlefs@3.0.4-gcc10.3-1757bed...
esp8266:mklittlefs@3.0.4-gcc10.3-1757bed installed
Installing esp8266:python3@3.7.2-post1...
esp8266:python3@3.7.2-post1 installed
Installing platform esp8266:esp8266@3.0.2...
Configuring platform....
Platform esp8266:esp8266@3.0.2 installed

$ SKETCH_PATH="/tmp/FooSketch"

$ arduino-cli sketch new "$SKETCH_PATH"
Sketch created in: C:\Users\per\AppData\Local\Temp\FooSketch

$ printf "#include <vector>\nvoid setup() {}\nvoid loop() {}" > "${SKETCH_PATH}/FooSketch.ino"

$ arduino-cli compile -b esp8266:esp8266:generic "$SKETCH_PATH"
Executable segment sizes:
ICACHE : 32768           - flash instruction cache
IROM   : 231500          - code in flash         (default or ICACHE_FLASH_ATTR)
IRAM   : 26217   / 32768 - code in IRAM          (IRAM_ATTR, ISRs...)
DATA   : 1496  )         - initialized variables (global, static) in RAM/HEAP
RODATA : 876   ) / 81920 - constants             (global, static) in RAM/HEAP
BSS    : 25520 )         - zeroed variables      (global, static) in RAM/HEAP
Sketch uses 260089 bytes (27%) of program storage space. Maximum is 958448 bytes.
Global variables use 27892 bytes (34%) of dynamic memory, leaving 54028 bytes for local variables. Maximum is 81920 bytes.


Used platform   Version Path
esp8266:esp8266 3.0.2   C:\Users\per\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2

@tblake3 do you get different results if you perform that procedure?

Step 1, I had an older version of arduino-cli so I updated that to lastest version, same as your example.

arduino-cli core install esp8266:esp8266

Platform esp8266:esp8266@3.0.2 already installed is the only line that came up.

I carried through with the rest of the commands. The FooSketch compiled successfully.

When I went back to my own sketch, it had the same error regarding vector not found.

I had more of a think on this one. Your example sketch referenced directly and worked fine. My sketch that is giving me trouble #include <WiFiManager.h> which in turn has #include .
Then I created a test.ino in the same folder as my original sketch

#include <vector>
void setup (){}
void loop (){}

No go, fatal error: vector: No such file or directory.

My original sketch was in ~/wifiman/wifiman.ino. I created a new folder in ~/Arduino >> ~/Arduino/sketchs/wifiman and moved everthing over there. It works fine now.

I don't know why that makes a difference but someone who is smarter than I may find that information useful to diagnose the problem.

The folder structure is not clear to me. Was it like this:

~/
└── wifiman/
    ├── test.ino
    └── wifiman.ino

or like this?:

~/
├── test/
│   └── test.ino
└── wifiman/
    └── wifiman.ino

If you don't consider it a secret, what is the true path ~ aliases (e.g., the output of echo ~)?

The reason I ask is because there have been some problems with certain characters in paths breaking the Arduino build system's library discovery. Even though it seems less likely since the working sketch path is also under ~, it is possible that the problematic folder name being the direct parent of the sketch is a required condition of the bug.

~/wifiman/wifiman.ino Didn't work
~/wifiman/test.ino Also no go.

~/Arduino/sketches/wifiman/wifiman.ino works just fine.

echo ~
/home/dietpi

It doesn't look like there are any problematic characters such as multiple spaces in a row or post-ASCII characters.

I tried it out on my Linux machine and didn't have any problem even with the sketch folder directly under ~.

So unfortunately I'm quite stumped about what could cause this thing.

Do you have problems with sketches in that location that have #include directives for other header files from the toolchain. Like this one?:

#include <stdlib.h>
void setup() {}
void loop() {}

Maybe one of the other forum members has an idea?