Repository navigation
VECTOR_INCLUDE_FIX
github-actions[bot] edited this page Oct 16, 2025
·
1 revision
Compilation errors when building projects that use AlteriomPainlessMesh:
error: 'vector' in namespace 'std' does not name a template type
std::vector<ConnectionInfo> getConnectionDetails() {
^~~~~~
note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
The file src/painlessmesh/mesh.hpp uses std::vector but was missing the required include:
#include <vector>This caused compilation failures in any code that included painlessMesh.h.
-
src/painlessmesh/mesh.hpp- Usesstd::vector<ConnectionInfo>at line 386 -
src/painlessmesh/mesh.hpp- Usesstd::vector<uint32_t>at line 594
Added #include <vector> to the top of src/painlessmesh/mesh.hpp:
#ifndef _PAINLESS_MESH_MESH_HPP_
#define _PAINLESS_MESH_MESH_HPP_
#include <vector> // ← ADDED THIS LINE
#include "painlessmesh/configuration.hpp"
// ... rest of includesThis is a common C++ compilation issue where:
- Sometimes the
<vector>header gets transitively included by other headers - Works on some compilers/platforms but not others
- Depends on which headers are included first in your project
- May work in the library's test environment but fail in user projects
After this fix, the following should compile successfully:
#include <Arduino.h>
#include <painlessMesh.h>
Scheduler userScheduler;
painlessMesh mesh;
void setup() {
Serial.begin(115200);
mesh.init("TestMesh", "password", &userScheduler, 5555);
// This function uses std::vector internally
auto connections = mesh.getConnectionDetails();
}
void loop() {
mesh.update();
}To get the fix:
-
Clean your build:
pio run --target clean rm -rf .pio
-
Update library:
pio pkg update
-
Rebuild:
pio run
The library will be re-downloaded from GitHub with the fix included.
Your build output should change from:
Before (ERROR):
error: 'vector' in namespace 'std' does not name a template type
*** [.pio/build/universal-sensor/libb89/AlteriomPainlessMesh/painlessMeshSTA.cpp.o] Error 1
After (SUCCESS):
Building .pio/build/universal-sensor/libb89/AlteriomPainlessMesh/painlessMeshSTA.cpp.o
Building .pio/build/universal-sensor/libb89/AlteriomPainlessMesh/wifi.cpp.o
Linking .pio/build/universal-sensor/firmware.elf
SUCCESS
This is part of a series of library structure fixes:
- ✅ Added
srcDirandincludeDirto library.json - ✅ Removed conflicting
export.includesection - ✅ Fixed header references in library.properties
- ✅ Added missing
#include <vector>to mesh.hpp ← This fix
October 15, 2025
✅ FIXED - Ready for use