I am using Intel Paralle Studio XE 2019 Update 4 Composer Edition for Fortran Windows together with MS Visual Studio 2017 Community Edition.
I often come accross with the error
"LNK 1104 cannot open file ..." (for example xxx.dll)
during linking. Only solution to get over this is to restart PC. It really makes me angry. I am not simply able to compile and debug my code. Is there any more elegant way of avoiding this error. Please.
Here are the most common causes of this and similar issues:
- Antivirus software detects a newly created file and locks it while it scans, preventing a build tool (usually the Manifest Tool) from accessing it. The solution is to tell your AV program to not scan your build area
- A previous debugger session holds the EXE open after exit - only restarting Visual Studio helps. More recent VS releases seem to have resolved that.
Now, you name a DLL, which puzzles me a bit because the linker doesn't "open" DLLs. It does create them, so is this DLL the thing being built? I haven't seen a symptom where a computer restart was required. Can you show us the complete and exact text of the error? Better would be to ZIP the buildlog.htm and attach it to a reply here so we can see exactly what the issue is.
I have set of DLL projects. Output of each is sent to a folder, Plugins, under the program that I develop. This link problem does NOT happen always. I do not know if it helps to change output folder because of this randomness. How I will test it? My projects are under Documents if it was the question. Thanks for your time...
Try this. The next time it happens, see if you can delete or rename the existing DLL in the output directory. If you can, redo the build and see if it works. My guess is that there is some background program opening the DLL file and holding onto the file handle. One can use the free Process Monitor tool to identify the culprit, but you need to play with filters to screen out irrelevant events.
I have found out the background process responsible for this annoying problem with the help of process explorer. You helped me a lot. I still enjoy programming :)...