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!
26734 Discussions

LNK1104 cannot open file 'ifmodintr.lib'

avinashs
New Contributor I
1,231 Views

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
1 Solution
Steve_Lionel
Black Belt Retired Employee
1,231 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

7 Replies
Steve_Lionel
Black Belt Retired Employee
1,232 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

avinashs
New Contributor I
1,231 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?

Steve_Lionel
Black Belt Retired Employee
1,231 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.

JohnNichols
Valued Contributor II
964 Views

FortranFan suggested in a post this morning that the Fortran Lang Discourse as a good site to follow. 

I had a  quick look at the site and there was a simple Fortran program on trees. It looked interesting so I grabbed the code. It is attached.

But I got a ifmodintr.lib missing link error.  It was easy to fix. but why does a simple Fortran program need a mixed programming fix? 

 

Steve_Lionel
Black Belt Retired Employee
949 Views

Normally, you don't need a fix. If the compiler is installed properly, ifmodintr.lib should be found with the default set of library directories. Where you can get into trouble is if the main program is not Fortran and you have not set up the library paths for the other language. Another thing I have seen is where people have set their environment to point to an ancient version of the Intel libraries where ifmodintr.lib didn't exist.

JohnNichols
Valued Contributor II
942 Views

Intel® Fortran Compiler – toolkit version: 2021.1-beta10, extension version 19.2.0060.16, Package ID: w_oneAPI_2021.1.2288, Copyright © 2002-2020 Intel Corporation. All rights reserved.
* Other names and brands may be claimed as the property of others.

Created new project in visual studio 2019 preview 

added the Fortran code to main program unit

error repeated.

added C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\compiler\lib\ia32_win

to linker additional library directories 

still seems weird?

Steve_Lionel
Black Belt Retired Employee
931 Views

Your program links fine for me in VS2019 and the oneAPI compiler.

This is what I have under Libraries:

$(VSInstallDir)VC\Tools\MSVC\$(VCToolsVersion)\lib\x86
$(UniversalCRTSdkDir)Lib\$(UCRTVersion)\um\x86
$(UniversalCRTSdkDir)Lib\$(UCRTVersion)\ucrt\x86
$(IFortInstallDir)compiler\lib\ia32_win
$(IFortInstallDir)..\..\..\mkl\latest\lib\ia32
$(VSInstallDir)VC\Tools\MSVC\$(VCToolsVersion)\atlmfc\lib\x86
$(WindowsSdkDir)lib\winv6.3\um\x86
$(FrameworkSDKDir)lib
Reply