Trying to compile my project and I keep getting this error.
I’ve deleted and updated/replaced all the packages in \.platformio\packages
.
I made sure the referenced file in the error is in \PlatformIO\Projects\ESP32MP3BasicPlayer\.pio\libdeps\esp32dev\ESP8266Audio\src
.
Any help would be really apprecaited! Thanks!
ERROR
Linking .pio\build\esp32dev\firmware.elf
c:/users/echo/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\src\main.cpp.o:(.literal._Z5setupv+0x1c): undefined reference to `vtable for AudioOutputULP'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32dev\firmware.elf] Error 1
Code
#include <Arduino.h>
#include "AudioFileSourceSD.h"
#include "AudioOutputULP.h"
#include "AudioGeneratorWAV.h"
#define SD_CardSelect 4 // Define the SD card select pin
// SPI / SD Card Pins
// #define SCK 18 // GPIO 18
// #define MISO 19 // GPIO 19
// #define MOSI 23 // GPIO 23
// Audio out is pin GPIO 25
File dir;
AudioFileSourceSD *source = NULL;
AudioOutputULP *output = NULL;
AudioGeneratorWAV *decoder = NULL;
bool allFilesPlayed = false;
void setup() {
Serial.begin(115200);
Serial.println();
delay(1000);
audioLogger = &Serial;
source = new AudioFileSourceSD();
output = new AudioOutputULP(1); // ()=stereo (1)=mono
decoder = new AudioGeneratorWAV();
Serial.println("Initializing SD card...");
if (SD.begin(SD_CardSelect)) { // Use the defined SD_CardSelect pin
Serial.println("SD card initialization successful");
} else {
Serial.println("SD card initialization failed");
}
dir = SD.open("/");
// Set the gain to 0.5 (50% volume)
output->SetGain(0.5);
}
void loop() {
if (!allFilesPlayed) {
if ((decoder) && (decoder->isRunning())) {
if (!decoder->loop()) {
decoder->stop();
Serial.println("Playback finished");
}
} else {
File file = dir.openNextFile();
if (file) {
if (String(file.name()).endsWith(".wav")) {
source->close();
String filePath = "/" + String(file.name()); // Add "/" in front of the file name
if (source->open(filePath.c_str())) {
Serial.printf("Playing '%s' from SD card...\n", filePath.c_str());
decoder->begin(source, output);
} else {
Serial.printf("Error opening '%s'\n", filePath.c_str());
}
}
} else {
Serial.println("All files played. Replaying...");
dir.rewindDirectory(); // Reset the directory to replay files
allFilesPlayed = true;
}
}
} else {
// You can add your replay logic here.
// For example, you can reset 'allFilesPlayed' to false to replay indefinitely,
// or implement a different replay strategy.
dir.rewindDirectory(); // Reset the directory to replay files
allFilesPlayed = false; // Reset the flag
}
}