LNK1168: cannot open blah.exe for writing

  • I've uninstalled, and reinstalled vs2010 professional and also qt and I still get this problem.
    If I build and run an app, any app, then close the app.
    And then make a change and build and run again, I get the linker error saying it can't open the executable for writing.

    My only option is to wait around for "System" to release it's handle, up to 60 seconds or so, at least, or use cygwin to do a "rm -rf ./dir/executable.exe" to force remove it.

    This is a stupid problem to have that prevents me from doing normal things. Like programming.

    How does everyone else not have this problem?
    I'm running Windows 7 64-bit.

  • Qt Champions 2017

    Welcome to the forum. Looks like your executable is still running in background. Go to task manager and kill the process. Then it should work fine.

  • Nope. It's not. This happens on every project, even a brand new one where I've added nothing to the project. If I use a file unlocking app, it say "System" is using it, but it won't let go of the handle to it and I can't unlock it.

  • Hi, if it's System, maybe it's some service that's holding your .exe file hostage, googling I found "this suggestion":http://www.sevenforums.com/software/72091-several-minute-delay-when-deleting-any-exe-file.html, open an administrative CMD window and type:
    net start AeLookupSvc
    net start PcaSvc

  • I must have looked for several hours for a solution online. This is exactly what the problem was. I had this two services disabled. Thank you sooooo much!!!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.