khoih-prog / ESP_WiFiManager

This is an ESP32 / ESP8266 WiFi Connection Manager with fallback web configuration portal. Use this library for configuring ESP32 (including ESP32-S2 and ESP32-C3), ESP8266 modules' WiFi, etc. Credentials at runtime. You can also specify static DNS servers, personalized HostName, fixed or random AP WiFi channel. With examples supporting ArduinoJson
MIT License
371 stars 97 forks source link

Dont' build using PlatformIO #78

Closed clabnet closed 2 years ago

clabnet commented 2 years ago

Describe the bug

                                 ^
.pio\libdeps\TTGO-wifimanager\ESP_WifiManager\src/ESP_WiFiManager-Impl.h:299:36: error: 'ESP_WMParameter' was not declared in this scope
.pio\libdeps\TTGO-wifimanager\ESP_WifiManager\src/ESP_WiFiManager-Impl.h:299:53: error: 'p' was not declared in this scope
 void ESP_WiFiManager::addParameter(ESP_WMParameter *p)
                                                     ^
In file included from c:\users\claud\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\5.2.0\functional:53:0,
                 from C:\Users\claud\.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src/WiFiGeneric.h:28,
                 from C:\Users\claud\.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src/WiFiSTA.h:28,
                 from C:\Users\claud\.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src/WiFi.h:32,
                 from .pio\libdeps\TTGO-wifimanager\ESP_WifiManager\src/ESP_WiFiManager.h:110,
                 from src\main.cpp:15:
c:\users\claud\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\5.2.0\typeinfo:39:37: error: expected declaration before end of line
*** [.pio\build\TTGO-wifimanager\src\src\main.cpp.o] Error 1

Steps to Reproduce

PlatformIO Core 5.2.4·Home 3.4.0

platformio.ini

[platformio]
src_dir = .
default_envs = TTGO-wifimanager

[common]
lib_deps_external = 
    khoih-prog/ESP_WifiManager@^1.8.0
    khoih-prog/ESP_DoubleResetDetector@>=1.2.1
    lorol/LittleFS_esp32@>=1.0.6

build_flags =
; set your debug output (default=Serial)
 -D DEBUG_ESP_PORT=Serial
; comment the following line to enable WiFi debugging
; -D NDEBUG

[env]
framework = arduino
monitor_speed = 115200
upload_speed = 921600

[env:TTGO-wifimanager]
platform = espressif32
board = ttgo-lora32-v1
build_flags = 
    -w

monitor_filters = esp32_exception_decoder   
;upload_port = COM3
lib_deps = 
    ${common.lib_deps_external}

Expected behavior

Build the minimal source code :

/*
***************************************************************************************************************************
*  AutoConnect_ESP32_minimal.ino
*  For ESP8266 / ESP32 boards
*  Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager
*  Licensed under MIT license
*****************************************************************************************************************************
*/
#if !(defined(ESP32))
#error This code is intended to run on ESP32 platform! Please check your Tools->Board setting.
#endif

#include <Arduino.h>
#include <ESP_WiFiManager-Impl.h>  //https://github.com/khoih-prog/ESP_WiFiManager
#include <ESP_WiFiManager.h>       //https://github.com/khoih-prog/ESP_WiFiManager

void setup() {
    Serial.begin(115200);
    while (!Serial)
        ;
    delay(200);
    Serial.print(F("\nStarting AutoConnect_ESP32_minimal on "));
    Serial.println(ARDUINO_BOARD);
    Serial.println(ESP_WIFIMANAGER_VERSION);
    ESP_WiFiManager ESP_wifiManager("AutoConnectAP");
    ESP_wifiManager.autoConnect("AutoConnectAP");
    if (WiFi.status() == WL_CONNECTED) {
        Serial.print(F("Connected. Local IP: "));
        Serial.println(WiFi.localIP());
    } else {
        Serial.println(ESP_wifiManager.getStatus(WiFi.status()));
    }
}

void loop() {}

Version ESP32 : EspressIF 3.4.0 Windows 11 PRO

khoih-prog commented 2 years ago

Hi @clabnet

Thanks for your interest in the library.

The h-file inclusion must be in the following order

#include <ESP_WiFiManager.h>              //https://github.com/khoih-prog/ESP_WiFiManager
#include <ESP_WiFiManager-Impl.h>         //https://github.com/khoih-prog/ESP_WiFiManager

not

#include <ESP_WiFiManager-Impl.h>  //https://github.com/khoih-prog/ESP_WiFiManager
#include <ESP_WiFiManager.h>       //https://github.com/khoih-prog/ESP_WiFiManager

I checked and don't know if I made a mistake somewhere so that you can have the version with the reverse inclusion order. If so, please let me know where and in which version.

Thanks,

khoih-prog commented 2 years ago

Hi @clabnet

Thanks to your reported issue, I realize that I must reduce the breaking effect of the v1.8.0 by creating a new ESP_WiFiManager releases v1.9.0.

Now you can just use

#include <ESP_WiFiManager.h>              //https://github.com/khoih-prog/ESP_WiFiManager

Sorry for the inconvenience,

Regards,


Releases v1.9.0

  1. Reduce the breaking effect of v1.8.0 by enabling compatibility with old code to include only ESP_WiFiManager.h. Check Important Breaking Change from v1.8.0
clabnet commented 2 years ago

Hi @khoih-prog, the v1.9.0 running fine. Thanks for the changes. Regards