Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29391 Discussions

>LINK : fatal error LNK1104: cannot open file

fbalderasintel
2,223 Views
Hello,

Using Visual Fortran 11.1.048 [Intel 64]
ATTACHED, is the build log.

I'm converting, from 32 bit to 64bit, a very simple utility which has only 4 subrountines in it
and no 3rd party lib dependencies.

I get this error

">LINK : fatal error LNK1104: cannot open file 'K3F_Utils.lib'"

'K3F_Utils.lib' is my own library that I'm trying to create. The project type is for a DLL.
The end resultwill bea DLL . The "lib" should contain the entry points orexports, symbols etc. for the DLL.

I reviewed other 1104 messages in the forum and usually had to do with spaces in the
path or 3rd party tools that were of a different platform. But I have no spaces, no 3rd
party links andthis projectlinksOKon x32 .

Seems like the message should probably be "cannot create file" but thats a different story.

I am able to create x64 applications with no problem. Its a conversion from x32 to x64 which seems to bethe problem. I may simply just start over with a brand new x64 solution and copy the code and then rebuild.

0 Kudos
1 Solution
Steven_L_Intel1
Employee
2,223 Views
This directive would tell the linker to link in that library, and indeed this is your problem. The directive would be reasonable in a project that linked to that library. I think you should remove the directive.

View solution in original post

0 Kudos
7 Replies
Steven_L_Intel1
Employee
2,222 Views
Attach the buildlog.htm from the Debug or Release folder, please.
0 Kudos
fbalderasintel
2,223 Views
Now has attachment.
0 Kudos
Steven_L_Intel1
Employee
2,223 Views
Interesting. It might be trying to create the .lib, though I would expect a different error. Does a file by that name exist? If so, can you delete it?
0 Kudos
fbalderasintel
2,222 Views

The lib does not previously exist. I delete the obj and everything in the x64 folder.
The lib does need to be created to support the DLL.

0 Kudos
fbalderasintel
2,222 Views
I created a New DLL project. Set the Debug/Release builds to x64. Copied over my source code files and added to project as "existing" files. Ran the build and got the same error EVEN THOUGH the the new project has a NEW name.
Heres the new error, but still referring to the OLD lib!
1>LINK : fatal error LNK1104: cannot open file 'K3F_Utils.lib'

Yet, here is the output which makes no reference to that old lib. Very Strange.
One of the source code files does go by that name. So I'm going to rename it, at which point there will be nothing by that name.


/OUT:"x64\Debug\K3F64_Utils.dll" /NOLOGO /MANIFEST /MANIFESTFILE:"C:\AGR_DEV\Ver1.0\K3F64_Utils\x64\Debug\K3F64_Utils.dll.intermediate.manifest" /DEBUG /PDB:"C:\AGR_DEV\Ver1.0\K3F64_Utils\x64\Debug\K3F64_Utils.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:"C:\AGR_DEV\Ver1.0\K3F64_Utils\x64\Debug\K3F64_Utils.lib" /DLL
0 Kudos
fbalderasintel
2,223 Views

I renamed the source code file. Now there is NOTHING referring to the old name. This is a new solution, a new project, all new names. Still trying to create a lib with the old name.


THEN I SAW THIS IN THE CODE:

!DEC$ OBJCOMMENT LIB:'K3F_Utils.lib'


Yikes, what is this? I wrote the code a few months ago and now cant rememeber why this line is in there.
I commented it out and now even the original project works in x64.

This is how I used it at the top of the .

subroutine foo

!DEC$ ATTRIBUTES DLLEXPORT::PromptResponseParser
!DEC$ ATTRIBUTES REFERENCE::PromptResponeRecords
!DEC$ ATTRIBUTES REFERENCE::responseCount
!DEC$ OBJCOMMENT LIB:'K3F_Utils.lib'

I must have copied the style from somewhere not understanding the purpose.
Can you comment on the purpose of OBJCOMMENT LIB ??????

0 Kudos
Steven_L_Intel1
Employee
2,224 Views
This directive would tell the linker to link in that library, and indeed this is your problem. The directive would be reasonable in a project that linked to that library. I think you should remove the directive.
0 Kudos
Reply