The below line is an Visual C++ only line.
To fix you need to add the linker option for MinGW GCC that matches the above option.
#pragma comment(linker, "/subsystem:windows")
from Compiling Windows GUI Application With MinGW Without Command Prompt
The old option was this
It was replaced in newer version of MinGW GCC with
I suggest finding directions for the same Compiler (MinGW GCC) you are using; the frustrations will be much less. Or, changing to use the Compiler in your directions.