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

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

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.

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

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

Ive encountered this problem when the build is abruptly closed before it is loaded. No process would show up in the Task Manager, but if you navigate to the executable generated in the project folder and try to delete it, Windows claims that the application is in use. (If not, just delete the file and rebuild, which generates a new executable)
In Windows(Visual Studio 2019), the file is located in this directory by default:

%USERPROFILE%sourcereposProjectFolderNameDebug

To end the allegedly running process, open the command prompt and type in the following command:

taskkill /F /IM ApplicationName.exe

This forces any running instance to be terminated.
Rebuild and execute!

Leave a Reply

Your email address will not be published.