Arduino: 1.8.9 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
C:\Users\REXUS\AppData\Local\Temp\cc0lRoN1.ltrans0.ltrans.o: In function `main':
<artificial>:(.text.startup+0x15c): undefined reference to `loop'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Please start by reading this first. (https://forum.arduino.cc/index.php?topic=148850.0)
Then you wont get corrupted text as your post shows.
undefined reference to `loop'
Usually means you have no loop!
Either you dont have loop() defined (all sketches must have setup and loop ) or you messed up the parens/braces elsewhere and the compiler didn't complain about some other consequence of that first.