Error compiling for board Arduino Mega or Mega 2560.

Hi. I am trying to make mihir-khara's medicine reminder and vending machine, but I keep geeting this error code:"Error compiling for board Arduino Mega or Mega 2560".

I tried process of elimination on the library's but they all compile. The code is the attachment.

Here is the Arduino Project Hub link to the project:
https://create.arduino.cc/projecthub/mihir-khara/medicine-reminder-and-vending-machine-18f063?f=1

If you need any more information, please let me know. Thank you

medicinereminder_ino.ino (29.5 KB)

Please do this:

  • When you encounter an error, you'll see a button on the right side of the orange bar "Copy error messages" in the Arduino IDE (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button..
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum's code tags markup to your reply.
  • Press "Ctrl + V". This will paste the error between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.

If the text exceeds the forum's 9000 character limit, save it to a .txt file and post it as an attachment. If you click the "Reply" button here, you will see an "Attachments and other settings" link that will allow you to make the attachment.

Perhaps one of these non-standard libraries is missing or incorrect (sometimes there are more than one library of the same name):

#include "RTClib.h"
#include <LiquidCrystal.h>
#include <ClickEncoder.h>
#include <TimerOne.h>
#include <DFMiniMp3.h>

Did mihir-khara include a list of where they found the libraries? If not, try "Tools->Manage Libraries..." first and then Google.

Here are the error messages:

Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"





















In file included from C:\Users\BKM43\AppData\Local\Temp\Temp1_MihirKhara-MedicineReminderVendingMachine-836eed3.zip\MihirKhara-MedicineReminderVendingMachine-836eed3\MedicineReminder\MedicineReminder.ino:37:0:

C:\Users\BKM43\Documents\Arduino\libraries\DFMiniMp3-master\src/DFMiniMp3.h: In instantiation of 'uint16_t DFMiniMp3<T_SERIAL_METHOD, T_NOTIFICATION_METHOD>::listenForReply(uint8_t) [with T_SERIAL_METHOD = HardwareSerial; T_NOTIFICATION_METHOD = Mp3Notify; uint16_t = unsigned int; uint8_t = unsigned char]':

C:\Users\BKM43\Documents\Arduino\libraries\DFMiniMp3-master\src/DFMiniMp3.h:199:51:   required from 'uint8_t DFMiniMp3<T_SERIAL_METHOD, T_NOTIFICATION_METHOD>::getVolume() [with T_SERIAL_METHOD = HardwareSerial; T_NOTIFICATION_METHOD = Mp3Notify; uint8_t = unsigned char]'

C:\Users\BKM43\AppData\Local\Temp\Temp1_MihirKhara-MedicineReminderVendingMachine-836eed3.zip\MihirKhara-MedicineReminderVendingMachine-836eed3\MedicineReminder\MedicineReminder.ino:208:35:   required from here

C:\Users\BKM43\Documents\Arduino\libraries\DFMiniMp3-master\src/DFMiniMp3.h:511:62: error: no matching function for call to 'Mp3Notify::OnPlayFinished(DfMp3_PlaySources, uint16_t&)'

                         T_NOTIFICATION_METHOD::OnPlayFinished(DfMp3_PlaySources_Usb, replyArg);

                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\BKM43\AppData\Local\Temp\Temp1_MihirKhara-MedicineReminderVendingMachine-836eed3.zip\MihirKhara-MedicineReminderVendingMachine-836eed3\MedicineReminder\MedicineReminder.ino:157:15: note: candidate: static void Mp3Notify::OnPlayFinished(uint16_t)

   static void OnPlayFinished(uint16_t globalTrack)

               ^~~~~~~~~~~~~~

C:\Users\BKM43\AppData\Local\Temp\Temp1_MihirKhara-MedicineReminderVendingMachine-836eed3.zip\MihirKhara-MedicineReminderVendingMachine-836eed3\MedicineReminder\MedicineReminder.ino:157:15: note:   candidate expects 1 argument, 2 provided

In file included from C:\Users\BKM43\AppData\Local\Temp\Temp1_MihirKhara-MedicineReminderVendingMachine-836eed3.zip\MihirKhara-MedicineReminderVendingMachine-836eed3\MedicineReminder\MedicineReminder.ino:37:0:

C:\Users\BKM43\Documents\Arduino\libraries\DFMiniMp3-master\src/DFMiniMp3.h:515:62: error: no matching function for call to 'Mp3Notify::OnPlayFinished(DfMp3_PlaySources, uint16_t&)'

                         T_NOTIFICATION_METHOD::OnPlayFinished(DfMp3_PlaySources_Sd, replyArg);

                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\BKM43\AppData\Local\Temp\Temp1_MihirKhara-MedicineReminderVendingMachine-836eed3.zip\MihirKhara-MedicineReminderVendingMachine-836eed3\MedicineReminder\MedicineReminder.ino:157:15: note: candidate: static void Mp3Notify::OnPlayFinished(uint16_t)

   static void OnPlayFinished(uint16_t globalTrack)

               ^~~~~~~~~~~~~~

C:\Users\BKM43\AppData\Local\Temp\Temp1_MihirKhara-MedicineReminderVendingMachine-836eed3.zip\MihirKhara-MedicineReminderVendingMachine-836eed3\MedicineReminder\MedicineReminder.ino:157:15: note:   candidate expects 1 argument, 2 provided

In file included from C:\Users\BKM43\AppData\Local\Temp\Temp1_MihirKhara-MedicineReminderVendingMachine-836eed3.zip\MihirKhara-MedicineReminderVendingMachine-836eed3\MedicineReminder\MedicineReminder.ino:37:0:

C:\Users\BKM43\Documents\Arduino\libraries\DFMiniMp3-master\src/DFMiniMp3.h:519:62: error: no matching function for call to 'Mp3Notify::OnPlayFinished(DfMp3_PlaySources, uint16_t&)'

                         T_NOTIFICATION_METHOD::OnPlayFinished(DfMp3_PlaySources_Flash, replyArg);

                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\BKM43\AppData\Local\Temp\Temp1_MihirKhara-MedicineReminderVendingMachine-836eed3.zip\MihirKhara-MedicineReminderVendingMachine-836eed3\MedicineReminder\MedicineReminder.ino:157:15: note: candidate: static void Mp3Notify::OnPlayFinished(uint16_t)

   static void OnPlayFinished(uint16_t globalTrack)

               ^~~~~~~~~~~~~~

C:\Users\BKM43\AppData\Local\Temp\Temp1_MihirKhara-MedicineReminderVendingMachine-836eed3.zip\MihirKhara-MedicineReminderVendingMachine-836eed3\MedicineReminder\MedicineReminder.ino:157:15: note:   candidate expects 1 argument, 2 provided

In file included from C:\Users\BKM43\AppData\Local\Temp\Temp1_MihirKhara-MedicineReminderVendingMachine-836eed3.zip\MihirKhara-MedicineReminderVendingMachine-836eed3\MedicineReminder\MedicineReminder.ino:37:0:

C:\Users\BKM43\Documents\Arduino\libraries\DFMiniMp3-master\src/DFMiniMp3.h:524:66: error: 'OnPlaySourceOnline' is not a member of 'Mp3Notify'

                         T_NOTIFICATION_METHOD::OnPlaySourceOnline(static_cast<DfMp3_PlaySources>(replyArg));

                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\BKM43\Documents\Arduino\libraries\DFMiniMp3-master\src/DFMiniMp3.h:529:68: error: 'OnPlaySourceInserted' is not a member of 'Mp3Notify'

                         T_NOTIFICATION_METHOD::OnPlaySourceInserted(static_cast<DfMp3_PlaySources>(replyArg));

                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\BKM43\Documents\Arduino\libraries\DFMiniMp3-master\src/DFMiniMp3.h:534:67: error: 'OnPlaySourceRemoved' is not a member of 'Mp3Notify'

                         T_NOTIFICATION_METHOD::OnPlaySourceRemoved(static_cast<DfMp3_PlaySources>(replyArg));

                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

exit status 1

Error compiling for board Arduino Mega or Mega 2560.



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

I already Compiled each library individually and all of them compiled. Mihir Khara did post a library folder, but it is a 7Z file, not a .ZIP.

Did mihir-khara include a list of where they found the libraries? If not, try "Tools->Manage Libraries..." first and then Google.

All the library's but the ClickEncoder, TimerOne, and DFMiniMp3 came from the library manager. I got the rest off of github.

It looks like the version of DFMiniMp3 you installed does not match the Mp3Notify class declared in the main sketch. The OnPlayFinished() function in the sketch takes ONE argument:

  static void OnPlayFinished(uint16_t globalTrack)
  {
    Serial.println();
    Serial.print("Play finished for #");
    Serial.println(globalTrack);   
  }

The DFMiniMp3 library you are using expects that function to take TWO arguments:

T_NOTIFICATION_METHOD::OnPlayFinished(DfMp3_PlaySources_Sd, replyArg);

You can either try to find the version of DFMiniMp3 that works with the Mp3Notify or read the DFMiniMp3 documentation and modify the Mp3Notify class to work with the DFMiniMp3.

The DFMiniMp3 library you are using expects that function to take TWO arguments:

I don't quite understand arguments. Really, I don't need the DFmini mp3 plyer parts. I was planning on using a buzzer instead. I also tried pasting in

T_NOTIFICATION_METHOD::OnPlayFinished(DfMp3_PlaySources_Sd, replyArg);
on line 159,
and it said: "T_NOTIFICATION_METHOD" does not name a type." Thank you.

gguppy:
Really, I don't need the DFmini mp3 plyer parts. I was planning on using a buzzer instead.

So take that stuff out and you won't have to worry about the mismatch.
I'd start by removing the "#include" line for the library. Then you can comment out everything that gets an error because the library isn't included. Eventually you will have commented out all uses of the library and there will be no errors left.

Hi, sorry for the late reply. I tried that and it worked. thank you very much. I will be using that method for other projects. Thank you again :slight_smile: