This error occurred because your settings are not correct.
For example I receive
cannot open output file Project1.exe: Permission denied collect2.exe: error: ld returned 1 exit status mingw32-make.exe: *** [Project1.exe] Error 1
Because I have no permission to write on my exe
file.