[GH-ISSUE #1628] Compilation Error - 'esp_wifi_set_country_code' was not declared in this scope #1387

Open
opened 2026-02-28 01:29:52 +03:00 by kerem · 3 comments
Owner

Originally created by @wagenbm on GitHub (Jun 18, 2023).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1628

Basic Infos

WiFimanager Branch/Release: Master

IDE

Arduino IDE v2.1.0

Board Selection in IDE: FireBeetle ESP32-E
Installed library for FireBeetle: DFRobot ESP32 Boards

Hardware

Hardware: ESP32-E Firebeetle

Description

Problem description

I am not able to compile my program when using the Wifimanager. I am always getting the following error:

c:\ESP32\libraries\WiFiManager\WiFiManager.cpp: In member function 'bool WiFiManager::WiFiSetCountry()':
c:\ESP32\libraries\WiFiManager\WiFiManager.cpp:3552:11: error: 'esp_wifi_set_country_code' was not declared in this scope
err = esp_wifi_set_country_code(_wificountry.c_str(), true);
^~~~~~~~~~~~~~~~~~~~~~~~~
c:\ESP32\libraries\WiFiManager\WiFiManager.cpp:3552:11: note: suggested alternative: 'esp_wifi_set_country'
err = esp_wifi_set_country_code(_wificountry.c_str(), true);
^~~~~~~~~~~~~~~~~~~~~~~~~
esp_wifi_set_country

exit status 1

I tried with downgrading the version and found out, that the problem happens as of version 2.0.12beta.

I figured out, that the problem disappears, when changing the board selection in Arduino IDE. As I wanted to try it out with a different Board, I changed in the IDE the Board selection to 'ESP32 Dev Module'. With this selection, there is no compilation error, also the latest version works fine. Is the FireBeetle probably not supported?

Sketch

#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager

void setup() {
    WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
    // it is a good practice to make sure your code sets wifi mode how you want it.

    // put your setup code here, to run once:
    Serial.begin(115200);
    
    //WiFiManager, Local intialization. Once its business is done, there is no need to keep it around
    WiFiManager wm;

    bool res;

    res = wm.autoConnect("AutoConnectAP","password"); // password protected ap

    if(!res) {
        Serial.println("Failed to connect");
        // ESP.restart();
    } 

}

void loop() {

}
Originally created by @wagenbm on GitHub (Jun 18, 2023). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1628 ### Basic Infos WiFimanager Branch/Release: Master ### IDE Arduino IDE v2.1.0 Board Selection in IDE: FireBeetle ESP32-E Installed library for FireBeetle: DFRobot ESP32 Boards #### Hardware Hardware: ESP32-E Firebeetle ### Description Problem description I am not able to compile my program when using the Wifimanager. I am always getting the following error: c:\ESP32\libraries\WiFiManager\WiFiManager.cpp: In member function 'bool WiFiManager::WiFiSetCountry()': c:\ESP32\libraries\WiFiManager\WiFiManager.cpp:3552:11: error: 'esp_wifi_set_country_code' was not declared in this scope err = esp_wifi_set_country_code(_wificountry.c_str(), true); ^~~~~~~~~~~~~~~~~~~~~~~~~ c:\ESP32\libraries\WiFiManager\WiFiManager.cpp:3552:11: note: suggested alternative: 'esp_wifi_set_country' err = esp_wifi_set_country_code(_wificountry.c_str(), true); ^~~~~~~~~~~~~~~~~~~~~~~~~ esp_wifi_set_country exit status 1 I tried with downgrading the version and found out, that the problem happens as of version 2.0.12beta. I figured out, that the problem disappears, when changing the board selection in Arduino IDE. As I wanted to try it out with a different Board, I changed in the IDE the Board selection to 'ESP32 Dev Module'. With this selection, there is no compilation error, also the latest version works fine. Is the FireBeetle probably not supported? ### Sketch ``` #include <WiFiManager.h> // https://github.com/tzapu/WiFiManager void setup() { WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP // it is a good practice to make sure your code sets wifi mode how you want it. // put your setup code here, to run once: Serial.begin(115200); //WiFiManager, Local intialization. Once its business is done, there is no need to keep it around WiFiManager wm; bool res; res = wm.autoConnect("AutoConnectAP","password"); // password protected ap if(!res) { Serial.println("Failed to connect"); // ESP.restart(); } } void loop() { } ```
Author
Owner

@Sukeczech commented on GitHub (Nov 6, 2024):

the problem still persists even on the latest version, how to solve it?

<!-- gh-comment-id:2460517761 --> @Sukeczech commented on GitHub (Nov 6, 2024): the problem still persists even on the latest version, how to solve it?
Author
Owner

@tablatronix commented on GitHub (Nov 8, 2024):

I assume the wrong libraries are being included, or its pinned to an older version of the SDK, see if there is an updated board def for that board, or remove and reinstall it, if its outdated then you might have to just use another board def

<!-- gh-comment-id:2463648064 --> @tablatronix commented on GitHub (Nov 8, 2024): I assume the wrong libraries are being included, or its pinned to an older version of the SDK, see if there is an updated board def for that board, or remove and reinstall it, if its outdated then you might have to just use another board def
Author
Owner

@Sukeczech commented on GitHub (Nov 8, 2024):

When I put the older version it works. But from 2.0.12beta up id did not.

<!-- gh-comment-id:2464022490 --> @Sukeczech commented on GitHub (Nov 8, 2024): When I put the older version it works. But from 2.0.12beta up id did not.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1387
No description provided.