VC++ fatal error LNK1168: cannot open filename.exe for writing

前端 未结 12 1842
悲&欢浪女
悲&欢浪女 2020-12-01 03:38

suddenly my visual studio express 2010 c++ stopped rebuilding my project.
When I first hit F7 the project builds and runs fine (heck, it\'s a hello world example).
T

相关标签:
12条回答
  • 2020-12-01 03:56

    The problem is probably that you forgot to close the program and that you instead have the program running in the background.

    Find the console window where the exe file program is running, and close it by clicking the X in the upper right corner. Then try to recompile the program. In my case this solved the problem.

    I know this posting is old, but I am answering for the other people like me who find this through the search engines.

    0 讨论(0)
  • 2020-12-01 04:02

    FINALLY THE BEST WAY WORKED PERFECTLY FOR ME

    None of the solutions in this page worked for me EXCEPT THE FOLLOWING

    Below the comment sections of the second answer, try the following :

    Adding to my above comment, Task Manager does not display the filename.exe process but Resource Monitor does, so I'm able to kill it from there which solves the issue without having to reboot. – A__ Jun 19 '19 at 21:23

    0 讨论(0)
  • 2020-12-01 04:02

    Start your program as an administrator. The program can't rewrite your files cause your files are in a protected location on your hard drive.

    0 讨论(0)
  • 2020-12-01 04:03

    Enable “Application Experience” service. Launch a console window and type net start AeLookupSvc

    • http://support.microsoft.com/kb/902196
    0 讨论(0)
  • 2020-12-01 04:04

    This can also be a problem from the improper use of functions like FindNextFile when a FindClose is never executed. The process of the built file is terminated, and the build itself can be deleted, but LNK1168 will prevent a rebuild because of the open handle. This can create a handle leak in Explorer which can be addressed by terminating and restarting Explorer, but in many cases an immediate reboot is necessary.

    0 讨论(0)
  • 2020-12-01 04:09

    Restarting Visual Studio solved the problem for me.

    0 讨论(0)
提交回复
热议问题