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

LINK : fatal error LNK1104: cannot open file 'ifmodintr.lib'

Syed_R_
Beginner
1,697 Views

I have a Visual Studio Fortran project that creates a library called MyLibrary.lib that can be used by Fortran and C++ programs.

Then, I have a C++ test program that uses this MyLibrary.lib. However, when I compile and link this test program in Visual Studio on a computer that does NOT have ifort installed on it, the Visual Studio throws the following error:

LINK : fatal error LNK1104: cannot open file 'ifmodintr.lib'

My problem is the following:
I do not want the user of the test program to add ifmodintr.lib. Therefore, I added ifmodintr.lib in the "Additional Dependencies" in the Fortran project that creates MyLibrary.lib. But this does not have any effect.

My question is:
How can I link ifmodintr.lib in MyLibrary.lib (in the Fortran project) so that a C++ uses will not have to need ifmodintr.lib on his or her computer.

0 Kudos
13 Replies
Steven_L_Intel1
Employee
1,697 Views

You could extract the objects from ifmodintr.lib and insert them in your own library.

0 Kudos
Syed_R_
Beginner
1,697 Views

I can do it easily in Linux and Mac. However, Visual Studio is a bit tricky for me.

Is there a website that you can point to that has example of extracting the objects from a library to insert them in another library?

0 Kudos
TimP
Honored Contributor III
1,697 Views
0 Kudos
Syed_R_
Beginner
1,697 Views

I am getting LINK warning LNK4014 error in extracting iso_c_binding.obj. Below is what I have done on the visual studio command prompt.  First, I have listed the member names, then I have attempted to extract them. Although, the member names are same that were listed in the /list command, the errors are still showing up.

C:\Program Files (x86)\Intel\Composer XE 2013 SP1\compiler\lib\ia32>lib ifmodintr.lib /extract:/frt1/static/iso_fortran_env.obj /out:a

C:\Program Files (x86)\Intel\Composer XE 2013 SP1\compiler\lib\ia32>lib /list ifmodintr.lib
Microsoft (R) Library Manager Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

./frtl/static/iso_c_binding.obj
./frtl/static/iso_fortran_env.obj
./frtl/static/ieee_exceptions.obj
./frtl/static/ieee_arithmetic.obj
./frtl/static/ieee_features.obj

C:\Program Files (x86)\Intel\Composer XE 2013 SP1\compiler\lib\ia32>lib ifmodintr.lib /extract:./frt1/static/iso_c_binding.obj /out:iso_c_binding.obj
Microsoft (R) Library Manager Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : warning LNK4014: cannot find member object ./frt1/static/iso_c_binding.obj

0 Kudos
mecej4
Honored Contributor III
1,697 Views

The /OUT:<filename> option of LIB is to specify the name of an output library. For extracting .OBJ files without modifying the library itself, this option is not applicable.

0 Kudos
Syed_R_
Beginner
1,697 Views

So then what should I do to extract the objects from ifmodintr.lib and then insert them in my own library?

0 Kudos
mecej4
Honored Contributor III
1,697 Views

Extract one or more OBJ files from the first library:

[bash]lib ifmodintr.lib /extract:/frt1/static/iso_fortran_env.obj[/bash]

Merge them into the second library:

[bash]lib mynewlib.lib iso_fortran_env.obj[/bash]

0 Kudos
Steven_L_Intel1
Employee
1,697 Views

I think you can also merge libraries without extracting the objects separately. You can do this merge or extract/insert in a post-build step.

0 Kudos
Syed_R_
Beginner
1,697 Views

Even after merging libraries without extracting the objects separately, I get the following in the test program:

LINK : fatal error LNK1104: cannot open file 'ifmodintr.lib'

0 Kudos
Steven_L_Intel1
Employee
1,697 Views

Ah,yes.  When you use the module, it adds a directive to pull in that library. So you will need to set the option Libraries > Disable default libraries. Do you provide the other Intel Fortran libraries? How do your users link now?

0 Kudos
Syed_R_
Beginner
1,697 Views

I have set the disable default libraries when I build my library, but the test program still complains about the LINK : fatal error LNK1104: cannot open file 'ifmodintr.lib'.

Yes, I am providing other Fortran libraries like:

svml_disp.lib
ifmodintr.lib
ifconsol.lib  
libifcoremt.lib
libifport.lib

0 Kudos
Syed_R_
Beginner
1,697 Views

I set the following to YES in Libraries option of my project where I am building my library:

1. Disable Default Library Search Rules: Yes

2. Disable OBJECTCOMMENT Library Names in Object: Yes

With these two options set to YES, I got rid of intel fortran errors. However, I am now getting the following:

LINK : fatal error LNK1104: cannot open file 'libirc.lib'

Any ideas how to get rid of this one?

0 Kudos
Syed_R_
Beginner
1,697 Views

In my test program, I added libirc.lib in the linker --> Ignore Specific Default Libraries. This enabled my test program to fully build without any errors.

Thank you all and Steve for the replies and inputs.

0 Kudos
Reply