- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to solve this in the newest oneAPI 2023.2 (command line, not VS IDE)?
1. Run "x64 Native Tools Command Prompt for VS 2022" from the Start Menu
2. Change to project working directory
3. Run '%ONEAPI_ROOT%\setvars.bat'
4. ifort complains during compilation it cannot find ifmodintr.lib and ifconsol.lib
It worked normally in older oneAPI versions by running 'compilervars.bat intel64'.
Thanks for any advice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This sequence works when I try it. Please copy and paste the command prompt session from start to end. Also add a "SET LIB" command so I can see what's there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Okay, I made a mistake of overwriting the LIB variable inside the compilation batch. After the correction the linker complained it can't find kernel32.lib , so I installed W10 SDK. It works!
Thank you
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page