Can someone help please with this compiling error:
It's not a compiling error. It is a linker message. Without seeing your code, no we can't help you.
Why are you using SoftwareSerial on a Mega with 4 hardware serial ports?
Why do you think the issue is related to SoftwareSerial when the message CLEARLY says HardwareSerial?