End names are a feature introduced with SystemVerilog. In Verilog files (files that have a .v suffix or that are explicitly configured to be treated as Verilog), using end names is not allowed.
In a verilog file:
module main;
endmodule : main
A Quick Fix is offered for this error which can remove the illegal end name.