How can I link .a FORTRAN libraries to mex files?

조회 수: 1 (최근 30일)
Ana Hiza Ramírez Andrade
Ana Hiza Ramírez Andrade 2020년 8월 5일
답변: Nipun Katyal 2020년 8월 10일
I'm trying to use a fortran library, with extension .a, with a fortran source mex file.
I have tried
mex FileName.F -L/library_path -lLibName
but I get the error:
Error using mex
MEX cannot find library 'LibName', specified with the -l option.
MEX searched for a file with one of the following names:
libLibName.lib
LibName.lib
Does anyone know how to link .a files to mex files?

답변 (1개)

Nipun Katyal
Nipun Katyal 2020년 8월 10일
The issue at hand is that the mex compiler is trying to find a ".lib" file instead of a ".a" file. If you are using windows you will have to get the windows distribution of the library. If you are on linux you can check the path to library and find the correct usage for mex compiler flags given here.

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by