- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could extract the objects from ifmodintr.lib and insert them in your own library.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So then what should I do to extract the objects from ifmodintr.lib and then insert them in my own library?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
![](/skins/images/76FBCD0056552B7B74FE0D35ED948B09/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page