フィルターのクリア

mex function : fatal error LNK1120: 1 unresolved externals

14 ビュー (過去 30 日間)
Markela Bargiampa
Markela Bargiampa 2023 年 8 月 30 日
編集済み: James Tursa 2023 年 9 月 4 日
I need to compile a fortran file (myfortranfile.for) using the mex function. As i learned the fortran file must be in .f so i just renamed my file to .f instead of .for. Can someone help? After running the mex function it didn't work , showing the above:
>> matlab_MB_New
Building with 'Intel oneAPI 2023 for Fortran with Microsoft Visual Studio 2022'.
C:\Users\...\ ..\myfortranfile.f(528): remark #8291: Recommended relationship between field width 'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+7'.
102 FORMAT (1X,I3,1X,F9.3,1x,4(E9.3,1X),4(E11.5,1X),3(E11.5,1X))
----------------------------------^
C:\Users\..\myfortranfile.f(528): remark #8291: Recommended relationship between field width 'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+7'.
102 FORMAT (1X,I3,1X,F9.3,1x,4(E9.3,1X),4(E11.5,1X),3(E11.5,1X))
---------------------------------------------^
C:\Users\...\myfortranfile.f(528): remark #8291: Recommended relationship between field width 'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+7'.
102 FORMAT (1X,I3,1X,F9.3,1x,4(E9.3,1X),4(E11.5,1X),3(E11.5,1X))
---------------------------------------------------------^
Error using mex
LINK : error LNK2001: unresolved external symbol MEXFUNCTION
myfortranfile.lib : fatal error LNK1120: 1 unresolved externals
Error in matlab_MB_New (line 5)
mex myfortranfile.f
  3 件のコメント
Markela Bargiampa
Markela Bargiampa 2023 年 9 月 4 日
no my fortran file doesn't have a subroutine mexfuntion. It's an old fortran code, do I have to add it?
James Tursa
James Tursa 2023 年 9 月 4 日
編集済み: James Tursa 2023 年 9 月 4 日
Yes, you have to add it. The subroutine mexfunction is the interface between your Fortran code and MATLAB. It would help if you posted the code, or at least described what the code does and what the inputs & outputs are. E.g., why are you trying to connect it with MATLAB?

サインインしてコメントする。

回答 (1 件)

MYBLOG
MYBLOG 2023 年 8 月 30 日
Use command
mex myfortranfile.f -compatibleArrayDims -output myfortranfunction
  1 件のコメント
Markela Bargiampa
Markela Bargiampa 2023 年 9 月 4 日
didn't work. what is myfortranfunction??

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFortran with MATLAB についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by