Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
252 Views

LNK1104 cannot open file 'ifmodintr.lib'

Jump to solution

I have a C++ project in MSVS2017 that references a static Fortran library built in IVF 19.0.2.190. A build error is encountered while running the C++ project: LNK1104 cannot open file 'ifmodintr.lib'. This project was run successfully a few of years ago (2016) with another version of the IVF static lib.

1. How do you include this library in the project path as a default setting?
2. Also, is there a way to "package" this and other required libraries in the static Fortran library?

Any help will be greatly appreciated. 

0 Kudos

Accepted Solutions
Highlighted
Black Belt Retired Employee
252 Views

See https://software.intel.com/en-us/articles/configuring-visual-studio-for-mixed-language-applications

No, you can't package the Intel libraries in your own.

View solution in original post

0 Kudos
3 Replies
Highlighted
Black Belt Retired Employee
253 Views

See https://software.intel.com/en-us/articles/configuring-visual-studio-for-mixed-language-applications

No, you can't package the Intel libraries in your own.

View solution in original post

0 Kudos
Highlighted
New Contributor I
252 Views

Thanks. The steps outline in the link fixed the problem. As a point of clarification, if the Fortran static library has various versions (Debug/Release and IA-32/Intel64), can VS2017 be configured to automatically link to the correct one?

0 Kudos
Highlighted
Black Belt Retired Employee
252 Views

For mixed-language applications the best approach is to set the Fortran static library project property Fortran > Libraries > Disable default library search rules > Yes. This means that you will need to add the names of the Intel Fortran run-time libraries in Linker > Additional Dependencies in your C main project. The reason you can't mix sets is that C/C++ cares at compile-time which set you use - Fortran doesn't. (If the main program is Fortran, then it will pull in the appropriate libraries.)

Instead of manually adding the library names to the C++ project, if there is an object from your library that is always used, you can add OBJCOMMENT directives to specify the Fortran libraries. From the Fortran perspective, the debug and release libraries are the same. So you'd add the following lines to the relevant source(s):

!DIR$ OBJCOMMENT LIB:"ifconsol.lib"
!DIR$ OBJCOMMENT LIB:"libifcoremd.lib"
!DIR$ OBJCOMMENT LIB:"libifportmd.lib"
!DIR$ OBJCOMMENT LIB:"libmmd.lib"
!DIR$ OBJCOMMENT LIB:"ifmodintr.lib"

This should handle most cases. If you do this, you must disable default library search rules in the library project.

0 Kudos