Error Compiling TMRpcm

This is the first time im using this library and i cant seem to get it to compile, i keep getting this error

In file included from C:\Users\MohammadB\Desktop\Arduino Projects\audio (1)\audio (1).ino:1:
c:\Users\MohammadB\Documents\Arduino\libraries\TMRpcm/TMRpcm.h:95:32: error: 'SdFile' has not been declared
95 | unsigned long searchMainTags(SdFile xFile, char *datStr);
| ^~~~~~

exit status 1

Compilation error: exit status 1

Welcome to the forum

Please post your full sketch, using code tags when you do. Did you write the sketch or did you get it from somewhere ?

I didnt write it, i got it from a video on youtube, multiple videos had similar code though, so I assumed it should work, here is the code:

#include <SD.h>               // need to include the SD library
#define SD_ChipSelectPin 15   //pin10 for Arduino Pro Mini
#include <TMRpcm.h>           //  Lib to play wav file
#include <SPI.h>

TMRpcm tmrpcm;   // create an object for use in this sketch


void setup(){
  tmrpcm.speakerPin = 5; //pin 9 for Aduino Pro Mini , any pin with PWM fonction will work too
  Serial.begin(9600);

  if (!SD.begin(SD_ChipSelectPin)) {  // see if the card is present and can be initialized:
    Serial.println("SD fail");  
    return;   // don't do anything more if not
  }
  else{   
    Serial.println("SD ok");   
  }
  tmrpcm.play("Audio1.wav"); //the sound file "music" will play each time the arduino powers up, or is reset
  tmrpcm.volume(5); //default volume to 2 
}

void loop(){
 
}

I'm using Nodemcu for reference

If you turn on compilation warnings in Preferences in the IDE you will see this message when you compile the sketch

WARNING: library TMRpcm claims to run on avr architecture(s) and may be incompatible with your current board which runs on esp8266 architecture(s).

That is the cause of the error

Is there a way to solve this or can i just simply not use esp8266 with the tmrpcm library?

You need to use a different library but I cannot offer any advice as to which one would work

Alright, thank you so much for the help

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.