I think that you have included some libraries in the sketch. The problem is that one of the libraries doesn't support the Arduino Mega.
As a solution, I suggest that you to comment out the libraries one by one and then try to compile the program. If the error is gone then trycode runs successfully,try to install that library with other versions. Don't forget to remove the previous library.