INADDR_NONE problem

Hi, this may be a simple fix for someone but I could use the help as I’m a noob. I’m running an Adafruit feather huzzah 32 on vscode with the PIO and its giving me this error, I’ve looked around and found similar problems but their solves didn’t work for me, or I was too stupid to understand it.

 Processing featheresp32 (platform: espressif32; board: featheresp32; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/featheresp32.html
PLATFORM: Espressif 32 (3.1.0) > Adafruit ESP32 Feather
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 3.10005.210308 (1.0.5)
- tool-esptoolpy 1.30000.201119 (3.0.0)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 59 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP Async WebServer> 1.2.3
|   |-- <AsyncTCP> 1.1.1       
|   |-- <FS> 1.0
|   |-- <WiFi> 1.0
|   |-- <ArduinoJson> 6.17.3   
|-- <ArduinoLog> 1.0.3
|-- <ArduinoJson> 6.17.3       
|-- <AsyncMqttClient> 0.8.2
|   |-- <AsyncTCP> 1.1.1
|-- <ESP32Servo> 0.9.0
|-- <ESP32 AnalogWrite> 0.2.0
|-- <RdUtils>
|-- <RdFileManager>
|   |-- <RdConfig>
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <Preferences> 1.0
|   |-- <RdConfigPinMap>
|   |-- <RdJson>
|   |   |-- <ArduinoLog> 1.0.3
|   |-- <RdUtils>
|   |-- <FS> 1.0
|   |-- <ESP Async WebServer> 1.2.3
|   |   |-- <AsyncTCP> 1.1.1
|   |   |-- <FS> 1.0
|   |   |-- <WiFi> 1.0
|   |   |-- <ArduinoJson> 6.17.3
|-- <RdRestAPIEndpoints>
|   |-- <ArduinoLog> 1.0.3
|-- <RdJson>
|   |-- <ArduinoLog> 1.0.3
|-- <RdConfigPinMap>
|-- <RdConfig>
|   |-- <RdJson>
|   |   |-- <ArduinoLog> 1.0.3
|   |-- <Preferences> 1.0
|-- <RdWebServer>
|   |-- <RdConfig>
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <Preferences> 1.0
|   |-- <RdRestAPIEndpoints>
|   |   |-- <ArduinoLog> 1.0.3
|   |-- <RdFileManager>
|   |   |-- <RdConfig>
|   |   |   |-- <RdJson>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <Preferences> 1.0
|   |   |-- <RdConfigPinMap>
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <RdUtils>
|   |   |-- <FS> 1.0
|   |   |-- <ESP Async WebServer> 1.2.3
|   |   |   |-- <AsyncTCP> 1.1.1
|   |   |   |-- <FS> 1.0
|   |   |   |-- <WiFi> 1.0
|   |   |   |-- <ArduinoJson> 6.17.3
|   |-- <AsyncTCP> 1.1.1
|   |-- <RdConfigPinMap>
|   |-- <ESP Async WebServer> 1.2.3
|   |   |-- <AsyncTCP> 1.1.1
|   |   |-- <FS> 1.0
|   |   |-- <WiFi> 1.0
|   |   |-- <ArduinoJson> 6.17.3
|-- <RdRestAPISystem>
|   |-- <RdCommandScheduler>
|   |   |-- <RdConfig>
|   |   |   |-- <RdJson>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <Preferences> 1.0
|   |   |-- <RdUtils>
|   |   |-- <RdRestAPIEndpoints>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |-- <RdFileManager>
|   |   |-- <RdConfig>
|   |   |   |-- <RdJson>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <Preferences> 1.0
|   |   |-- <RdConfigPinMap>
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <RdUtils>
|   |   |-- <FS> 1.0
|   |   |-- <ESP Async WebServer> 1.2.3
|   |   |   |-- <AsyncTCP> 1.1.1
|   |   |   |-- <FS> 1.0
|   |   |   |-- <WiFi> 1.0
|   |   |   |-- <ArduinoJson> 6.17.3
|   |-- <RdMQTTManager>
|   |   |-- <RdConfig>
|   |   |   |-- <RdJson>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <Preferences> 1.0
|   |   |-- <RdRestAPIEndpoints>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <RdWiFiManager>
|   |   |   |-- <WiFi> 1.0
|   |   |   |-- <RdConfig>
|   |   |   |   |-- <RdJson>
|   |   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |   |-- <Preferences> 1.0
|   |   |   |-- <RdStatusIndicator>
|   |   |   |   |-- <RdConfig>
|   |   |   |   |   |-- <RdJson>
|   |   |   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |   |   |-- <Preferences> 1.0
|   |   |   |   |-- <RdConfigPinMap>
|   |   |   |   |-- <RdUtils>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <ESPmDNS> 1.0
|   |   |   |   |-- <WiFi> 1.0
|   |   |-- <AsyncMqttClient> 0.8.2
|   |   |   |-- <AsyncTCP> 1.1.1
|   |   |-- <PubSubClientESP32>
|   |   |-- <RdUtils>
|   |-- <RdNetLog>
|   |   |-- <RdCommandSerial>
|   |   |   |-- <RdConfig>
|   |   |   |   |-- <RdJson>
|   |   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |   |-- <Preferences> 1.0
|   |   |   |-- <RdFileManager>
|   |   |   |   |-- <RdConfig>
|   |   |   |   |   |-- <RdJson>
|   |   |   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |   |   |-- <Preferences> 1.0
|   |   |   |   |-- <RdConfigPinMap>
|   |   |   |   |-- <RdJson>
|   |   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |   |-- <RdUtils>
|   |   |   |   |-- <FS> 1.0
|   |   |   |   |-- <ESP Async WebServer> 1.2.3
|   |   |   |   |   |-- <AsyncTCP> 1.1.1
|   |   |   |   |   |-- <FS> 1.0
|   |   |   |   |   |-- <WiFi> 1.0
|   |   |   |   |   |-- <ArduinoJson> 6.17.3
|   |   |   |-- <RdUtils>
|   |   |   |-- <RdJson>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <RdMQTTManager>
|   |   |   |-- <RdConfig>
|   |   |   |   |-- <RdJson>
|   |   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |   |-- <Preferences> 1.0
|   |   |   |-- <RdRestAPIEndpoints>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <RdWiFiManager>
|   |   |   |   |-- <WiFi> 1.0
|   |   |   |   |-- <RdConfig>
|   |   |   |   |   |-- <RdJson>
|   |   |   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |   |   |-- <Preferences> 1.0
|   |   |   |   |-- <RdStatusIndicator>
|   |   |   |   |   |-- <RdConfig>
|   |   |   |   |   |   |-- <RdJson>
|   |   |   |   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |   |   |   |-- <Preferences> 1.0
|   |   |   |   |   |-- <RdConfigPinMap>
|   |   |   |   |   |-- <RdUtils>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |   |-- <ESPmDNS> 1.0
|   |   |   |   |   |-- <WiFi> 1.0
|   |   |   |-- <AsyncMqttClient> 0.8.2
|   |   |   |   |-- <AsyncTCP> 1.1.1
|   |   |   |-- <PubSubClientESP32>
|   |   |   |-- <RdUtils>
|   |   |-- <RdRingBuffer>
|   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <WiFi> 1.0
|   |-- <RdNTPClient>
|   |   |-- <RdConfig>
|   |   |   |-- <RdJson>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <Preferences> 1.0
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <RdUtils>
|   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <WiFi> 1.0
|   |-- <RdOTAUpdate>
|   |   |-- <RdConfig>
|   |   |   |-- <RdJson>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <Preferences> 1.0
|   |   |-- <RdUtils>
|   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <HTTPClient> 1.2
|   |   |   |-- <WiFi> 1.0
|   |   |   |-- <WiFiClientSecure> 1.0
|   |   |   |   |-- <WiFi> 1.0
|   |   |-- <WiFi> 1.0
|   |   |-- <Update> 1.0
|   |-- <RdRestAPIEndpoints>
|   |   |-- <ArduinoLog> 1.0.3
|   |-- <RdWiFiManager>
|   |   |-- <WiFi> 1.0
|   |   |-- <RdConfig>
|   |   |   |-- <RdJson>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <Preferences> 1.0
|   |   |-- <RdStatusIndicator>
|   |   |   |-- <RdConfig>
|   |   |   |   |-- <RdJson>
|   |   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |   |-- <Preferences> 1.0
|   |   |   |-- <RdConfigPinMap>
|   |   |   |-- <RdUtils>
|   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <ESPmDNS> 1.0
|   |   |   |-- <WiFi> 1.0
|-- <MgLedStrip>
|   |-- <RdConfig>
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <Preferences> 1.0
|   |-- <RdConfigPinMap>
|   |-- <RdUtils>
|-- <RdCommandScheduler>
|   |-- <RdConfig>
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <Preferences> 1.0
|   |-- <RdUtils>
|   |-- <RdRestAPIEndpoints>
|   |   |-- <ArduinoLog> 1.0.3
|-- <RdCommandSerial>
|   |-- <RdConfig>
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <Preferences> 1.0
|   |-- <RdFileManager>
|   |   |-- <RdConfig>
|   |   |   |-- <RdJson>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <Preferences> 1.0
|   |   |-- <RdConfigPinMap>
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <RdUtils>
|   |   |-- <FS> 1.0
|   |   |-- <ESP Async WebServer> 1.2.3
|   |   |   |-- <AsyncTCP> 1.1.1
|   |   |   |-- <FS> 1.0
|   |   |   |-- <WiFi> 1.0
|   |   |   |-- <ArduinoJson> 6.17.3
|   |-- <RdUtils>
|   |-- <RdJson>
|   |   |-- <ArduinoLog> 1.0.3
|-- <RdDebugLoopTimer>
|   |-- <ArduinoLog> 1.0.3
|-- <RdMQTTManager>
|   |-- <RdConfig>
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <Preferences> 1.0
|   |-- <RdRestAPIEndpoints>
|   |   |-- <ArduinoLog> 1.0.3
|   |-- <RdWiFiManager>
|   |   |-- <WiFi> 1.0
|   |   |-- <RdConfig>
|   |   |   |-- <RdJson>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <Preferences> 1.0
|   |   |-- <RdStatusIndicator>
|   |   |   |-- <RdConfig>
|   |   |   |   |-- <RdJson>
|   |   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |   |-- <Preferences> 1.0
|   |   |   |-- <RdConfigPinMap>
|   |   |   |-- <RdUtils>
|   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <ESPmDNS> 1.0
|   |   |   |-- <WiFi> 1.0
|   |-- <AsyncMqttClient> 0.8.2
|   |   |-- <AsyncTCP> 1.1.1
|   |-- <PubSubClientESP32>
|   |-- <RdUtils>
|-- <RdNetLog>
|   |-- <RdCommandSerial>
|   |   |-- <RdConfig>
|   |   |   |-- <RdJson>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <Preferences> 1.0
|   |   |-- <RdFileManager>
|   |   |   |-- <RdConfig>
|   |   |   |   |-- <RdJson>
|   |   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |   |-- <Preferences> 1.0
|   |   |   |-- <RdConfigPinMap>
|   |   |   |-- <RdJson>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <RdUtils>
|   |   |   |-- <FS> 1.0
|   |   |   |-- <ESP Async WebServer> 1.2.3
|   |   |   |   |-- <AsyncTCP> 1.1.1
|   |   |   |   |-- <FS> 1.0
|   |   |   |   |-- <WiFi> 1.0
|   |   |   |   |-- <ArduinoJson> 6.17.3
|   |   |-- <RdUtils>
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |-- <RdMQTTManager>
|   |   |-- <RdConfig>
|   |   |   |-- <RdJson>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <Preferences> 1.0
|   |   |-- <RdRestAPIEndpoints>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <RdWiFiManager>
|   |   |   |-- <WiFi> 1.0
|   |   |   |-- <RdConfig>
|   |   |   |   |-- <RdJson>
|   |   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |   |-- <Preferences> 1.0
|   |   |   |-- <RdStatusIndicator>
|   |   |   |   |-- <RdConfig>
|   |   |   |   |   |-- <RdJson>
|   |   |   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |   |   |-- <Preferences> 1.0
|   |   |   |   |-- <RdConfigPinMap>
|   |   |   |   |-- <RdUtils>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <ESPmDNS> 1.0
|   |   |   |   |-- <WiFi> 1.0
|   |   |-- <AsyncMqttClient> 0.8.2
|   |   |   |-- <AsyncTCP> 1.1.1
|   |   |-- <PubSubClientESP32>
|   |   |-- <RdUtils>
|   |-- <RdRingBuffer>
|   |-- <ArduinoLog> 1.0.3
|   |-- <WiFi> 1.0
|-- <RdNTPClient>
|   |-- <RdConfig>
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <Preferences> 1.0
|   |-- <RdJson>
|   |   |-- <ArduinoLog> 1.0.3
|   |-- <RdUtils>
|   |-- <ArduinoLog> 1.0.3
|   |-- <WiFi> 1.0
|-- <RdSerialConsole>
|   |-- <RdConfig>
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <Preferences> 1.0
|   |-- <RdRestAPIEndpoints>
|   |   |-- <ArduinoLog> 1.0.3
|-- <RdStatusIndicator>
|   |-- <RdConfig>
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <Preferences> 1.0
|   |-- <RdConfigPinMap>
|   |-- <RdUtils>
|-- <RdWiFiManager>
|   |-- <WiFi> 1.0
|   |-- <RdConfig>
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <Preferences> 1.0
|   |-- <RdStatusIndicator>
|   |   |-- <RdConfig>
|   |   |   |-- <RdJson>
|   |   |   |   |-- <ArduinoLog> 1.0.3
|   |   |   |-- <Preferences> 1.0
|   |   |-- <RdConfigPinMap>
|   |   |-- <RdUtils>
|   |-- <ArduinoLog> 1.0.3
|   |-- <ESPmDNS> 1.0
|   |   |-- <WiFi> 1.0
|-- <RdOTAUpdate>
|   |-- <RdConfig>
|   |   |-- <RdJson>
|   |   |   |-- <ArduinoLog> 1.0.3
|   |   |-- <Preferences> 1.0
|   |-- <RdUtils>
|   |-- <ArduinoLog> 1.0.3
|   |-- <HTTPClient> 1.2
|   |   |-- <WiFi> 1.0
|   |   |-- <WiFiClientSecure> 1.0
|   |   |   |-- <WiFi> 1.0
|   |-- <WiFi> 1.0
|   |-- <Update> 1.0
|-- <WiFi> 1.0
Building in release mode
Compiling .pio\build\featheresp32\src\main.cpp.o
Archiving .pio\build\featheresp32\lib72e\libESP Async WebServer.a
Compiling .pio\build\featheresp32\lib247\ArduinoLog\ArduinoLog.cpp.o
Compiling .pio\build\featheresp32\lib784\AsyncMqttClient\AsyncMqttClient.cpp.o
Compiling .pio\build\featheresp32\lib784\AsyncMqttClient\AsyncMqttClient\Packets\ConnAckPacket.cpp.o
Compiling .pio\build\featheresp32\lib784\AsyncMqttClient\AsyncMqttClient\Packets\PingRespPacket.cpp.o
Compiling .pio\build\featheresp32\lib784\AsyncMqttClient\AsyncMqttClient\Packets\PubAckPacket.cpp.o
In file included from C:/Users/PSW Electrics/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/lwip/lwip/ip_addr.h:43:0,
                 from C:/Users/PSW Electrics/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/tcpip_adapter/tcpip_adapter.h:24,
                 from C:/Users/PSW Electrics/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp32/esp_event_legacy.h:23,
                 from C:/Users/PSW Electrics/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp_event/esp_event.h:26,
                 from C:/Users/PSW Electrics/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp32/esp_event_loop.h:22,
                 from C:/Users/PSW Electrics/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiGeneric.h:27,
                 from C:/Users/PSW Electrics/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiSTA.h:28,
                 from C:/Users/PSW Electrics/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFi.h:32,
                 from src/main.cpp:58:
C:/Users/PSW Electrics/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/lwip/lwip/ip4_addr.h:79:37: error: expected ')' before numeric constant
 #define IPADDR_NONE         ((u32_t)0xffffffffUL)
                                     ^
C:/Users/PSW Electrics/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/lwip/lwip/inet.h:71:29: note: in expansion of macro 'IPADDR_NONE'
 #define INADDR_NONE         IPADDR_NONE
                             ^
lib/RdUtils/Utils.h:26:32: note: in expansion of macro 'INADDR_NONE'
     static const unsigned long INADDR_NONE = ((unsigned long)0xffffffff);
                                ^
Compiling .pio\build\featheresp32\lib784\AsyncMqttClient\AsyncMqttClient\Packets\PubCompPacket.cpp.o
Compiling .pio\build\featheresp32\lib784\AsyncMqttClient\AsyncMqttClient\Packets\PubRecPacket.cpp.o
*** [.pio\build\featheresp32\src\main.cpp.o] Error 1

I would imagine its conflicting code in one/all of those three files but I don’t know what needs to change. Any help would be much appreciated. here’s the link to the code I am using https://github.com/Rowdy-Lixxx/lost-sand.git.

The library you’re using has a conflict with the definition of INADDR_NONE in framework-arduinoespressif32/tools/sdk/include/lwip/lwip/inet.h. The code in RdUtils/Utils.h attempts to create a variable with the name INADDR_NONE but the aforementioned header file already macro-defines it to IPADDR_NONE which is mapped to ((u32_t)0xffffffffUL) so the fully extended line looks like

static const unsigned long ((u32_t)0xffffffffUL) = ((unsigned long)0xffffffff);

which is of course invalid code.

My best guess would be that you can comment that line out (lib/RdUtils/Utils.h:26) and it should cause no problems since INADDR_NONE is still defined and still maps to the constant 0xffffffff.

To make it more general you can also do it as

#ifndef INADDR_NONE
static const unsigned long INADDR_NONE = ((unsigned long)0xffffffff);
#endif

so that you will provide the value for platforms that don’t predefine INADDR_NONE, and let the value be for those that have already defined it.

Commenting it out worked! The funny thing is I thought of doing that (with no reasoning behind it) but was worried it might cause a problem down the line, haha. But now that you explained it, it makes sense. Thank you.

I just ran across this thread, as I was hitting the same error myself.

The problem is that u32_t isn’t defined when IPAddress.h is included. Presumably the ordering of includes in esp_http_client.h is the problem, but I haven’t verified that. I was able to work around it by inserting the following two lines before esp_http_client.h:

#include <arch/cc.h>
#include <IPAddress.h>

arch/cc.h is where u32_t is defined, so that ensures it’s defined when IPAddress.h is included.

I prefer that solution because it’s not going to be overwritten when the SDK is updated or when I do a clean build.