The reason why you get the message is that the code is being compiled for the wrong board. Make sure that the board is set to "ESP Dev Module" before you try to compile the code. Once you select the ESP32 as the target the Arduino environment should compile the correct version of WiFi.cpp and the error should go away.

It appears that your example is not for the ESP32 but for a different WiFi adapter.