Linker Tools Error LNK1168, cannot open filename.exe for writing
There is one thing driving me crazy whenever I compile a cpp program:
Linker Tools Error LNK1168, cannot open filname.exe for writing
This error occurs everyday.
I was able to realize that this problem occurred because the exe file was not finished even after I stop my debugging.
What I tried to solve this problem:
On task manager, I tried to end the process ( which is in my case, Samsung2.exe ) but however I click that, there is no response.
the below paragraph is from
""" If your executable can’t be overwritten by the build process, it may be locked by File Explorer. If the Application Experience service has been disabled, File Explorer may hold on to an executable file handle lock for an extended time. To fix this issue, run services.msc and then open the Properties dialog box for the Application Experience service. Change the Startup type from Disabled to Manual. """
There is no Application Experience service (on windows 10 )
- I downloaded 'Process Explorer' and tried to kill my process.
but only error message pops up ( " access is denied " )
It is shortening my life. Can you help me?
FYI, I'm using Visual Studio 2017 and Windows 10(64 bits)
Not an answer, but too long for a comment.
The snapshot in your question shows the processes (parents & children), not the handles.
To find who is blocking your file:
- Ctrl + F | Enter your executable name | Search | Wait
- Select the founded process.
- Ctrl +L
- Look for your file in the lower pane.
To close the handle: Right click the file | Close Handle
From my experience, sometimes the debugger does not end gracefully and keeps the file locked. The only solution that works for me is to close/kill VS or restart the computer. If the project is saved on Dropbox (or similar), the files might be locked while the synchronization is done and you get similar errors. The MS antivirus is smart enough not to interfere and so are most AVs.