Esp32 code compiling error

Hello developers,

Im having trouble compiling code for esp32 board. I have chose sample code from examples but that too is giving error I suspect some problem with esp32 board Library. Also want to mention that I have installed latest library and tried various old Arduino ide but same problem is coming. Any suggestions will be helpful. Thank you.

Operating system : windows 10, 64bit
Arduino ide version : 1.8.15
Esp32 library : 1.0.6

Your post was MOVED to it's current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

@ jenishthumar
Posting a picture of part of your code and part of the error message is a waste of time. Post your full cde and the full error message

The easier you make it to read and copy the code the more likely it is that you will get help

Please follow the advice given in the link below when posting code , use code tags and post the code here

We don't read photos. There is a "copy errors" button on the IDE. Click on that and your errors will be copied to your clipboard. Then post the error text here.

Hello developers,

Im having trouble compiling code for esp32 board. I have chose sample code from examples but that too is giving error I suspect some problem with esp32 board Library. Also want to mention that I have installed latest library and tried various old Arduino ide but same problem is coming. Any suggestions will be helpful. Thank you.

Operating system : windows 10, 64bit
Arduino ide version : 1.8.15
Esp32 library : 1.0.6

code:
/*

  • This sketch demonstrates how to scan WiFi networks.
  • The API is almost the same as with the WiFi Shield library,
  • the most obvious difference being the different file you need to include:
    */
    #include "WiFi.h"

void setup()
{
Serial.begin(115200);

// Set WiFi to station mode and disconnect from an AP if it was previously connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);

Serial.println("Setup done");

}

void loop()
{
Serial.println("scan start");

// WiFi.scanNetworks will return the number of networks found
int n = WiFi.scanNetworks();
Serial.println("scan done");
if (n == 0) {
    Serial.println("no networks found");
} else {
    Serial.print(n);
    Serial.println(" networks found");
    for (int i = 0; i < n; ++i) {
        // Print SSID and RSSI for each network found
        Serial.print(i + 1);
        Serial.print(": ");
        Serial.print(WiFi.SSID(i));
        Serial.print(" (");
        Serial.print(WiFi.RSSI(i));
        Serial.print(")");
        Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
        delay(10);
    }
}
Serial.println("");

// Wait a bit before scanning again
delay(5000);

}

error messsage:
Arduino: 1.8.15 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"

& was unexpected at this time.

exit status 1

Error compiling for board ESP32 Dev Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

What's happening today?
Why all the pictures?

Paste the actual error messages.

"& was unexpected at this time.
Exit status 1
Error compiling for board ESP32 Dev Module."

This is the error message.

Sorry for the picture I'm new in this community.

@ jenishthumar

TOPIC MERGED.

Could you take a few moments to Learn How To Use The Forum.

It will help you get the best out of the forum.

code::
/*

  • This sketch demonstrates how to scan WiFi networks.
  • The API is almost the same as with the WiFi Shield library,
  • the most obvious difference being the different file you need to include:
    */
    #include "WiFi.h"

void setup()
{
Serial.begin(115200);

// Set WiFi to station mode and disconnect from an AP if it was previously connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);

Serial.println("Setup done");

}

void loop()
{
Serial.println("scan start");

// WiFi.scanNetworks will return the number of networks found
int n = WiFi.scanNetworks();
Serial.println("scan done");
if (n == 0) {
    Serial.println("no networks found");
} else {
    Serial.print(n);
    Serial.println(" networks found");
    for (int i = 0; i < n; ++i) {
        // Print SSID and RSSI for each network found
        Serial.print(i + 1);
        Serial.print(": ");
        Serial.print(WiFi.SSID(i));
        Serial.print(" (");
        Serial.print(WiFi.RSSI(i));
        Serial.print(")");
        Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
        delay(10);
    }
}
Serial.println("");

// Wait a bit before scanning again
delay(5000);

}

Error message::

Arduino: 1.8.15 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"

& was unexpected at this time.

exit status 1

Error compiling for board ESP32 Dev Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


sorry for rookie mistake.
any code is giving same error.

first of all
You should post code by using code-tags
The following method can be used with the Arduino-IDE
NOT with some kind of Arduino Web-editor.

Your code should be a single code-section
otherwise it is a lot of work to get the code copied.
And even worse the small thing that causes the error could vanish by these mutliple code-sections

There is an automatic function for doing this in the Arduino-IDE
just three steps

  1. press Ctrl-T for autoformatting your code
  2. do a rightclick with the mouse and choose "copy for forum"
  3. paste clipboard into write-window of a posting

Then you should activate ALL compilerwarnings in the preferences of the Arduino-IDE

when the compiling stops with an error you see a button
Copy Error Messages

Click on this button to copy error-messages into the clipboard

Then click on the <|>-symbol to create a fixed-text-section
then press Ctrl-V to paste the clibboard-content into this text-section.

best regards Stefan

Mate read first code is from sample codes present in ide I was just displaying error message on ide.

Same error is coming in every code so there is no error in code problem is with library of esp32 board

anyway without activating show all error-messages
you slow down the process of solving the problem.

To state the obvoius:

  • did you add the additional board-URL in the preferences

did you use an actual additional board-URL ?

  • did you use the board-manager to install the ESP32-core?

You are working on an informatic project. And what is needed most in an informatic-project is information.

@jenishthumar
I have found yet another duplicate post from you in another section. I have given you a break from the forum to give you time to read and understand How to get the best out of this forum

I've locked this after disucsson with @jenishthumar
@jenishthumar will start again and has promised to provide proper information.