Hi, can anyone tell me what is the problem when I uploading? Below is the error messages. Thanks.
Arduino: 1.8.16 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
libraries\TMRpcm-master\TMRpcm.cpp.o (symbol from plugin): In function `optionByte':
(.text+0x0): multiple definition of `a'
sketch\test_change_code.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
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.
Looks like it is saying that your "test_change_code.ino" defines a global variable or function named "a" and so does TMRpcm.cpp in the TMRpcm library:
//*********** Standard Global Variables ***************
volatile unsigned int dataEnd;
volatile boolean buffEmpty[2] = {true,true}, whichBuff = false, playing = 0, a, b;
Change the name in your sketch to something other than 'a'.
Did you means the variable 'a' changes to another alphabet? It will not affect the others function?
//*********** Standard Global Variables ***************
volatile unsigned int dataEnd;
volatile boolean buffEmpty[2] = {true,true}, whichBuff = false, playing = 0, a, b;
Shouldn't the library declare those variables as 'static'? Odd to be declaring global variables in the cpp file without mentioning them in the header file.