Why do I get "LNK1104: cannot open file 'ifmodintr.lib'" using "mex" with a Fortran file?
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 29 de Mayo de 2024
Editada: MathWorks Support Team
el 29 de Mayo de 2024
I am using MATLAB R2024a on a Windows machine to build and link a C++ MEX function to a Fortran object file. The "mex" function is using Microsoft Visual C++ 2022 as a compiler, and the Fortran object file was compiled using the Intel oneAPI 2024 for Fortran compiler.
When a run the "mex" function, I get the following error
>> mex myMexFunction.cpp myFortranObject.obj
Building with 'Microsoft Visual C++ 2022'.
Error using mex
LINK : fatal error LNK1104: cannot open file 'ifmodintr.lib'
How can I resolve this error?
Respuesta aceptada
MathWorks Support Team
el 29 de Mayo de 2024
Editada: MathWorks Support Team
el 29 de Mayo de 2024
The "ifmodintr.lib" library is provided by Intel. By default, "mex" is not configured to search for Intel's library files when using the Microsoft Visual C++ compiler.
To resolve this error, you must add the directory that contains the Fortran compiler's library files to the search path used by "mex". This can be done using the "-L" option, which is described in the following documentation page:
For example, the default directory of the library files of the Intel oneAPI 2024 for Fortran compiler is
C:\Program Files (x86)\Intel\oneAPI\compiler\2024.0\lib\
. So, your "mex" command would become:
mex("myMexFunction.cpp", "myFortranObject.obj", ...
"-LC:\Program Files (x86)\Intel\oneAPI\compiler\2024.0\lib\");
For more information on insuring the compatibility of compilers used to build linked libraries and object files with the compiler used to build the "mex" function, see this article: https://www.mathworks.com/matlabcentral/answers/2123826-can-i-link-a-library-or-ojbect-file-built-with-one-compiler-to-a-mex-function-built-with-a-different
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Fortran with MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!