Github Devices Community Docs Blog

Build error with Arduino Mega + Ethernet Shield + Platformio on Mac

Hi - I am using Platforio for a while on Mac OSX to program ESP32 and 8266 boards, also I programmed ESP32 with OMG 0.9.3 version without issues including RF and BLE modules.

I decided to move away from ESP32 and build OMG 0.9.3 on Arduino Mega + W5100 ethernet shield + Bluetooth + RF 433Mhz modules.

My first attempt to build on a Mac with Platformio failed, ZgatewayBT.ino is missing, however it is in the main folder.

I have received the following errors:

Processing atmega-all (platform: atmelavr@1.13.0; board: megaatmega2560; framework: arduino)

Verbose mode can be enabled via -v, --verbose option


PLATFORM: Atmel AVR 1.13.0 > Arduino Mega or Mega 2560 ATmega2560 (Mega 2560)

HARDWARE: ATMEGA2560 16MHz, 8KB RAM, 248KB Flash


  • framework-arduinoavr 3.10623.190424 (1.6.23)

  • toolchain-atmelavr 1.50400.190710 (5.4.0)

Converting main.ino

/Users/balazsadam/Documents/PlatformIO/OpenMQTTGateway-0.9.3-MEGA/main/main.ino:37:0: warning: “array_size” redefined

#define array_size 4


/Users/balazsadam/Documents/PlatformIO/OpenMQTTGateway-0.9.3-MEGA/main/main.ino:32:0: note: this is the location of the previous definition

#define array_size 12


Unicode decode error has occurred, please remove invalid (non-ASCII or non-UTF8) characters from /Users/balazsadam/Documents/PlatformIO/OpenMQTTGateway-0.9.3-MEGA/main/main.ino.cpp file

LDF: Library Dependency Finder ->

LDF Modes: Finder ~ chain, Compatibility ~ soft

Found 50 compatible libraries

Scanning dependencies…

Dependency Graph

|-- 2.7

|-- 5.13.4

|-- 2.0.0

| |-- 1.0

|-- 2.3.3


| |--

| | |-- 1.0

| |-- 1.0

|-- 2.6.2 #90adb34

|-- #8eb980e

|-- 2.0.4

| |-- 1.0

| |-- 1.0


| |-- 1.0

|-- 1.0.2

|-- 1.3.0

| |-- 1.0.2

|-- 1.0.3

| |-- 1.0

| |-- 1.0.2

|-- #68142af

| |-- 1.0

|-- #968a684

| |-- 1.0

|-- 3.3.2

| |-- 1.0

| |-- 1.0

|-- 1.0

|-- 0.16.2

|-- 1.0

|-- 1.0

Building in release mode

Compiling .pio/build/atmega-all/src/main.ino.cpp.o

Compiling .pio/build/atmega-all/lib45b/PubSubClient_ID89/PubSubClient.cpp.o

Archiving .pio/build/atmega-all/libe10/libArduinoJson_ID64.a

Indexing .pio/build/atmega-all/libe10/libArduinoJson_ID64.a

/Users/balazsadam/Documents/PlatformIO/OpenMQTTGateway-0.9.3-MEGA/main/ZgatewayBT.ino:35:18: fatal error: vector: No such file or directory

compilation terminated.

Compiling .pio/build/atmega-all/lib056/SPI/SPI.cpp.o

*** [.pio/build/atmega-all/src/main.ino.cpp.o] Error 1

========================== [FAILED] Took 4.96 seconds ==========================

Environment Status Duration

rfbridge IGNORED

esp32dev-all IGNORED

esp32dev-rf IGNORED

esp32dev-pilight IGNORED

esp32dev-ir IGNORED

esp32dev-ble IGNORED

esp32-m5stick-ble IGNORED

esp32-m5stack-ble IGNORED

esp32-m5stick-c-ble IGNORED

ttgo-lora32-v1 IGNORED

nodemcuv2-all IGNORED

nodemcuv2-ble IGNORED

nodemcuv2-ir IGNORED

nodemcuv2-rf IGNORED

rf-wifi-gateway IGNORED

nodemcuv2-rf2 IGNORED

nodemcuv2-pilight IGNORED

sonoff-basic IGNORED

sonoff-basic-rfr3 IGNORED

atmega-all FAILED 00:00:04.957

uno-rf IGNORED

uno-fastled IGNORED

==================== 1 failed, 0 succeeded in 00:00:04.957 ====================

What do I do wrong?



Did you modified the atmega-all environment or is it the stock one?

In platformio.ini I enabled this:
default_envs = atmega-all

platform = ${com.atmelavr_platform}
board = megaatmega2560
lib_deps =
build_flags =


Could you try maybe to redownload the code, check that atmega-all is building properly. And if yes, remove the unnecessaries gateways and sensors.

Atmega-all with ZgatewayBT added has an issue with missing vector library:

D:/Users/Florian/Documents/GitHub/OpenMQTTGateway/main/ZgatewayBT.ino:35:18: fatal error: vector: No such file or directory
compilation terminated.
*** [.pio\build\atmega-all\src\main.ino.cpp.o] Error 1

I am getting the same issue in Ardunio IDE with Mega + W5100. How can this be resolved?

> ResolveLibrary(vector)
>   -> candidates: []ZgatewayBT:45:12: fatal error: vector: No such file or directory
>  #  include <vector>
>             ^~~~~~~~
> compilation terminated.

It seems that the vector library is not found with Arduino framework.
So we need to find one compatible.

@diablo I’ve built it successfully with the following modifications:

platform = ${com.atmelavr_platform}
board = megaatmega2560
lib_deps =
build_flags =

And add:
#include <ArduinoSTL.h>
at line 44 of ZgatewayBT.ino.

Please let me know if it works for you, if OK I will add it to the repository.

It appears to compile without issues in PlatformIO. When compiling in Arduino I get the following errors even after importing the library.

C:\Program Files (x86)\Arduino\libraries\ArduinoSTL-master\src\del_opnt.cpp:25:56: error: 'nothrow_t' in namespace 'std' does not name a type
 _UCXXEXPORT void operator delete(void* ptr, const std::nothrow_t& ) throw() {
C:\Program Files (x86)\Arduino\libraries\ArduinoSTL-master\src\del_ops.cpp:25:50: error: 'std::size_t' has not been declared
 _UCXXEXPORT void operator delete(void* ptr, std::size_t) throw(){

While it compiles in PlatformIO without errors, I have not tried it on the hardware as I returned the Bluetooth temperature sensor when I didn’t know if this would be fixed. I can order another one but my preference would be the cheaper PiLight Digoo R8S or R8H sensors. The Bluetooth sensors are $15 each and the PiLight ones are $5 each which will add up quickly because I want to use about 10 of them.