Error on arduino IDE

hello,
Here I have to connect an arduino UNO WIFI Rev2 to an amazon server in order to control connected objects. So for that I found a library that seems to suit my needs, the library in question is : WiFiClientSecure.
This library is compatible with arduino based on ESP32, and normally the arduino UNO WIFI Rev2 has it.
But here it is, when I compile my program I get this error message:

Arduino : 1.8.13 (Windows Store 1.8.39.0) (Windows 10), Carte : “u-blox NINA-W10 series (ESP32), 921600”

In file included from C:\Users<Users>\Documents\Arduino\libraries\WiFiClientSecure\src/random:49:0,

from C:\Users<Users>\Documents\Arduino\libraries\WiFiClientSecure\src/bits/stl_algo.h:66,

from C:\Users<Users>\Documents\Arduino\libraries\WiFiClientSecure\src/algorithm:62,

from C:\Users<Users>\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Arduino.h:142,

from sketch\WiFiClientSecure1.ino.cpp:1:

C:\Users<Users>\Documents\Arduino\libraries\WiFiClientSecure\src/bits/random.h: In constructor ‘std::bernoulli_distribution::param_type::param_type(double)’:

C:\Users<Users>\Documents\Arduino\libraries\WiFiClientSecure\src/bits/random.h:3585:55: error: ‘_GLIBCXX_DEBUG_ASSERT’ was not declared in this scope

_GLIBCXX_DEBUG_ASSERT((_M_p >= 0.0) && (_M_p <= 1.0));

^

C:\Users<Users>\Documents\Arduino\libraries\WiFiClientSecure\src/bits/random.h: In constructor ‘std::geometric_distribution<_IntType>::param_type::param_type(double)’:

C:\Users<Users>\Documents\Arduino\libraries\WiFiClientSecure\src/bits/random.h:4025:54: error: there are no arguments to ‘_GLIBCXX_DEBUG_ASSERT’ that depend on a template parameter, so a declaration of ‘_GLIBCXX_DEBUG_ASSERT’ must be available [-fpermissive]

_GLIBCXX_DEBUG_ASSERT((_M_p > 0.0) && (_M_p < 1.0));

^

C:\Users<Users>\Documents\Arduino\libraries\WiFiClientSecure\src/bits/random.h:4025:54: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)

C:\Users<Users>\Documents\Arduino\libraries\WiFiClientSecure\src/bits/random.h: In constructor ‘std::poisson_distribution<_IntType>::param_type::param_type(double)’:

C:\Users<Users>\Documents\Arduino\libraries\WiFiClientSecure\src/bits/random.h:4447:39: error: there are no arguments to ‘_GLIBCXX_DEBUG_ASSERT’ that depend on a template parameter, so a declaration of ‘_GLIBCXX_DEBUG_ASSERT’ must be available [-fpermissive]

_GLIBCXX_DEBUG_ASSERT(_M_mean > 0.0);

^

In file included from C:\Users<Users>\Documents\Arduino\libraries\WiFiClientSecure\src/algorithm:61:0,

from C:\Users<Users>\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Arduino.h:142,

from sketch\WiFiClientSecure1.ino.cpp:1:

C:\Users<Users>\Documents\Arduino\libraries\WiFiClientSecure\src/bits/stl_algobase.h: In instantiation of ‘void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long unsigned int*; _Tp = int]’:

C:\Users<Users>\Documents\Arduino\libraries\WiFiClientSecure\src/bits/stl_bvector.h:402:55: required from here

C:\Users<Users>\Documents\Arduino\libraries\WiFiClientSecure\src/bits/stl_algobase.h:741:37: error: ‘__glibcxx_requires_valid_range’ was not declared in this scope

__glibcxx_requires_valid_range(__first, __last);

^

Plusieurs bibliothèque trouvées pour “WiFi.h”

Utilisé : C:\Users<Users>\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.4\libraries\WiFi

Non utilisé : C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.39.0_x86__mdqgnx93n4wtt\libraries\WiFi

Non utilisé : C:\Users<Users>\Documents\Arduino\libraries\WiFiNINA

Plusieurs bibliothèque trouvées pour “WiFiClientSecure.h”

Utilisé : C:\Users<Users>\Documents\Arduino\libraries\WiFiClientSecure

Non utilisé : C:\Users<Users>\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.4\libraries\WiFiClientSecure

exit status 1

Erreur de compilation pour la carte u-blox NINA-W10 series (ESP32)

Thank you for your help.

Plusieurs bibliothèque trouvées pour "WiFiClientSecure.h"
Utilisé : C:\Users\<Users>\Documents\Arduino\libraries\WiFiClientSecure
Non utilisé : C:\Users\<Users>\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.4\libraries\WiFiClientSecure

You installed a “WiFiClientSecure” library and the compiler is using that one and not the one included with the ESP32 core. Try moving the Arduino\libraries\WiFiClientSecure directory out of the Arduino\libraries directory so the compiler uses the core library.

thank you very much it solved a lot of mistakes!
But now I have a new mistake that I don’t quite understand either:

Arduino : 1.8.13 (Windows Store 1.8.39.0) (Windows 10), Carte : “u-blox NINA-W10 series (ESP32), 921600”

Le croquis utilise 848470 octets (64%) de l’espace de stockage de programmes. Le maximum est de 1310720 octets.

Les variables globales utilisent 39664 octets (12%) de mémoire dynamique, ce qui laisse 288016 octets pour les variables locales. Le maximum est de 327680 octets.

esptool.py v2.6

Serial port COM6

Connecting…

Traceback (most recent call last):

File “esptool.py”, line 2959, in

File “esptool.py”, line 2952, in _main

File “esptool.py”, line 2653, in main

File “esptool.py”, line 460, in connect

File “esptool.py”, line 440, in _connect_attempt

File “esptool.py”, line 379, in sync

File “esptool.py”, line 322, in command

File “esptool.py”, line 285, in write

File “site-packages\serial\serialwin32.py”, line 323, in write

serial.serialutil.SerialTimeoutException: Write timeout

Failed to execute script esptool

Une erreur est survenue lors du transfert du croquis

This error does not occur during compilation but during transfert

Are you sure your ESP32 is connected to COM6?

When I choose the port I select the COM6 port but it recognizes the arduino UNO WIFI rev2.
But in the datasheet, it is specified that the card is based on an ESP32 u-blox NINA-W13 WiFi Module so for the type of card I change the "arduino UNO WIFI Rev2" by "u-blox NINA-W10 series (ESP32)" is it already wrong for that?

I’ve find an other library and I have this error, I don’t understand too :

In file included from C:\Users<user>\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/UART.h:28:0,
from C:\Users<user>\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/Arduino.h:143,
from C:\Users<user>\Documents\Arduino\libraries\WiFiNINA\src\utility\spi_drv.cpp:21:
C:\Users<user>\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.6\variants\uno2018/pins_arduino.h:116:24: error: expected unqualified-id before numeric constant
#define PINS_COUNT (40u)
^
C:\Users<user>\Documents\Arduino\libraries\WiFiNINA\src\utility\spi_drv.cpp:51:9: note: in expansion of macro ‘PINS_COUNT’
uint8_t PINS_COUNT;
^~~~~~~~~~
C:\Users<user>\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.6\variants\uno2018/pins_arduino.h:116:24: error: expected ‘)’ before numeric constant
#define PINS_COUNT (40u)
^
C:\Users<user>\Documents\Arduino\libraries\WiFiNINA\src\utility\spi_drv.cpp:51:9: note: in expansion of macro ‘PINS_COUNT’
uint8_t PINS_COUNT;
^~~~~~~~~~
C:\Users<user>\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.6\variants\uno2018/pins_arduino.h:119:24: error: expected unqualified-id before numeric constant
#define NINA_GPIO0 (28u) //28u
^
C:\Users<user>\Documents\Arduino\libraries\WiFiNINA\src\utility\spi_drv.cpp:52:9: note: in expansion of macro ‘NINA_GPIO0’
uint8_t NINA_GPIO0;
^~~~~~~~~~
C:\Users<user>\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.6\variants\uno2018/pins_arduino.h:119:24: error: expected ‘)’ before numeric constant
#define NINA_GPIO0 (28u) //28u
^
C:\Users<user>\Documents\Arduino\libraries\WiFiNINA\src\utility\spi_drv.cpp:52:9: note: in expansion of macro ‘NINA_GPIO0’
uint8_t NINA_GPIO0;
^~~~~~~~~~
exit status 1
Erreur de compilation pour la carte Arduino Uno WiFi Rev2

<user>\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.6\variants\uno2018/pins_arduino.h:116:24: error: expected unqualified-id before numeric constant
#define PINS_COUNT    (40u)
                       ^
C:\Users\<user>\Documents\Arduino\libraries\WiFiNINA\src\utility\spi_drv.cpp:51:9: note: in expansion of macro 'PINS_COUNT'
uint8_t PINS_COUNT;
        ^~~~~~~~~~

Very strange. It looks like “PINS_COUNT” is both #defined as “(40u)” and used as a variable name. When that happens you get some strange syntax after the #define substitutions:

 uint8_t (40u);

If your sketch doesn’t have a #define for “PIN_COUNT” then I don’t know where the conflict comes from. It seems to be a problem in the “WiFiNINA” library, whatever that is.

In fact, PIN_COUNT and NINA_GPIO0 are #define in a .h of WiFiNINA and in the megaavr package.
Do you think that if I modify these 2 #define in the WiFiNINA library the problem would be solved?

hugo8883:
In fact, PIN_COUNT and NINA_GPIO0 are #define in a .h of WiFiNINA and in the megaavr package.
Do you think that if I modify these 2 #define in the WiFiNINA library the problem would be solved?

Maybe. You could give it a try. You have to assume that the WiFiNINA library has not been tested on the MegaAVR processor so it may or may not be compatible.