Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26730 Discussions

LNK 1104 cannot open file during linking.

irhan__baris1
Beginner
358 Views

Dear All,

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.

Kind Regards,

Baris.

0 Kudos
11 Replies
Steve_Lionel
Black Belt Retired Employee
358 Views

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.

irhan__baris1
Beginner
358 Views

Hi Steve,

Thank you for your time. I send you in the attachment the log file...

irhan__baris1
Beginner
358 Views

Hi Steve,

Thank you for your time. I send you the log file...

irhan__baris1
Beginner
358 Views

...This problem occurs randomly, not always, and restarting MS Visual Studio is not a solution. PC must be restarted...

Steve_Lionel
Black Belt Retired Employee
358 Views

Thanks for the log. What happens if you change the output directory to just the project's Debug folder?  Is this build tree under Program Files or Windows?

irhan__baris1
Beginner
358 Views

Hi Steve,

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...

 

Steve_Lionel
Black Belt Retired Employee
358 Views

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.

irhan__baris1
Beginner
358 Views

Dear Steve,

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 :)...

irhan__baris1
Beginner
358 Views

... I used the following program where you can directly give the name of the file being currently used.

https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer

Steve_Lionel
Black Belt Retired Employee
358 Views

Glad to hear it. Out of curiosity, what kind of process was it?

irhan__baris1
Beginner
358 Views

...The GUI, with Borland, which loads a fortran dll, which loads all other fortran dlls. After I close Borland problem is solved without need to restart... 

Reply