Collect2: error: ld returned 1 exit status undefined reference to `Serial2'

Unable to build projects with any ESP32. I have a AZ-delivery ESP32-wroom-32 and a FREENOVE ESP-32WROVER-DEV for two of my current projects. I was able to build perfectly fine. But now I am unable to figure out what is the reason for these following errors.

I have tried some solutions to fix the problem from some tutorials online but I cant seem to link it to the “Serial2” issue

#include <Arduino.h>
#include <ArduinoJson.h>

StaticJsonDocument<50> doc;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  doc["weight"] = 22.1;
  doc["switch"] = true;
  doc["alarm"] = true;
  serializeJson(doc, Serial);
  Serial.println("JSON packet sent");
}

Again thanks for you help

That’s uh, weird. Can you remove the folders

  • /User/yohanjohn/.platformio/.cache
  • /User/yohanjohn/.platformio/packages/framework-arduinoespressif32

and retry building?

1 Like

Hi,

Not sure how but that did the trick thanks again for your help

Then it seems like you had a broken framework download if that fixed it.