Error while building program

How can I fix error which is being shown while building program
“c:/mingw/bin/…/lib/gcc/mingw32/6.3.0/…/…/…/…/mingw32/bin/ld.exe: cannot open output file C:\Users\Santosh Kumar\OneDrive\Desktop\Coding Blocks\Codes/min_maxtr.exe: Permission denied
collect2.exe: error: ld returned 1 exit status”

@sk1 hey,this is either an indication that you literally don’t have permission to modify that file, or that the file already exists and the program is currently running, so Windows is not letting you modify it.

My guess would be the latter, so I would guess that you’re trying to compile a C++ program that’s interactive (i.e. you’re trying to read from stdin to gather input), but that doesn’t work in Sublime Text without more setup.

As a result of this, after running your program once, it’s now sitting in the background waiting for you to give it input, but you can’t. Windows locks executable files while they’re running, so trying to compile and run it again now fails because the linker is trying to link a new version of the file but Windows won’t let it touch the file.

You need to use something like the task manager to kill the program running in the background, and then either not run programs that are interactive, or modify the build system you’re using to work here.

One of the better ways to achieve that is to use the Terminus package to do it. How you do that is documented in the README of the package, but it does require that you be familiar enough with the tools you’re using to know how to compile and run a program so that you can set up the build.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.