Those who developed a window based (native C/C++) application using Microsoft Visual Studio 2005 or above might have experienced an error similar as follows.
mt.exe:general error c101008d:Failed to write the updated manifest to the resource of file "some_sample.exe/dll". The process cannot access the file because it is being used by another process.
and if you build the exe again(or link again) it may get succeeded?,
What does this indicate? How to fix this issue?
The fix is very simple, disable your antivirus scan and try the build again (DO THIS AT YOUR OWN RISK. DON’T BLAME IF SOMETHING WRONG HAPPENS). Probably you wont face this issue anymore.
The reasons for this issues are.
Your anti-virus program is always vigilant on the executable files written in your system. So once your linker generates this exe, the file will undergo strict scanning by your anti-virus scanner if it’s active. During the scan time, the file will be exclusively locked by the anti-virus program.
The error you’re seeing about embedding manifest to the exe. Embedding manifest is not part of compilation or linking. You can embed manifest to any executable using the manifest tool (mt.exe). See How to embed a manifest in a C/C++ application.
mt.exe –manifest MyApp.exe.manifest -outputresource:MyApp.exe;1
or
mt.exe –manifest MyLibrary.dll.manifest -outputresource:MyLibrary.dll;2
the suffix “1” is for exe and “2” is for dll. This process is automated in Visual Studio (See, manifest generation in Visual Studio ).
Once the exe is written to the disk, visual studio will execute the next step using mt.exe to embed the application manifest in to it, but this time the file will be exclusively locked by antivirus which cause this error. if your antivirus lightning fast to scan the exes, you wont see this error.
This kind of error are quite easy to get in clear-case networks where the files in the views are access slightly less speed than a normal disk drive. In that case the antivirus program may take a bit more time completely scan the executable.