Error using mex command

2 次查看(过去 30 天)
Raksi Kopo
Raksi Kopo 2022-12-1
回答: Narvik 2023-9-13
I am trying to run this test file test_lfmm3dtria_direct.m from this 3D Boundary Element Method project https://github.com/mjcarley/bem3d/tree/master/fmmlib3d-1.2/matlab and i get the following error, even though there are some "fmm3d_r2012a.mexa64" , "fmm3d_r2012a.mexw32" files in the folder
Unrecognized function or variable 'fmm3d_r2012a'.
Error in lfmm3dtria (line 133)
[ier, pot, fld, pottarg, fldtarg] = fmm3d_r2012a(mex_id_, ier, iprec, nsource, triaflat, trianorm, source, ifcharge, charge, ifdipole, dipstr, dipvec,
ifpot, pot, iffld, fld, ntarget, target, ifpottarg, pottarg, iffldtarg, fldtarg, 1, 1, 1, 3, nsource, 3, nsource, 1, 1, 3, nsource, 1, 1, 1, 1, 1);
Error in test_lfmm3dtria_direct (line 77)
[U]=lfmm3dtria(iprec,ntri,triangles,trianorm,source,ifcharge,charge,ifdipole,dipstr,dipvec,ifpot,iffld,ntarget,target,ifpottarg,iffldtarg);
when i tried to rebuild them from the "fmm3d_r2012a.c" source file I got this.
mex fmm3d_r2012a.c
Building with 'MinGW64 Compiler (C)'.
Error using mex
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0x25ae): undefined reference to `hfmm3dtriaself_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0x3cea): undefined reference to `hfmm3dtriatarg_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0x523e): undefined reference to `h3dtriadirect_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0x601a): undefined reference to `lfmm3dtriaself_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0x7593): undefined reference to `lfmm3dtriatarg_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0x8688): undefined reference to `l3dtriadirect_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0x9411): undefined reference to `hfmm3dpartself_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0xa963): undefined reference to `hfmm3dparttarg_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0xba0c): undefined reference to `h3dpartdirect_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0xc648): undefined reference to `lfmm3dpartself_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0xd9c4): undefined reference to `lfmm3dparttarg_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0xe84e): undefined reference to `l3dpartdirect_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0xf7ad): undefined reference to `d3tstrcr_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0x10ed5): undefined reference to `d3tstrcrem_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0x116dd): undefined reference to `d3tgetb_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0x11c67): undefined reference to `d3tgetl_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0x11f2a): undefined reference to `prini_'
C:\Users\kopor\AppData\Local\Temp\mex_5474549107164433_18812\fmm3d_r2012a.obj:fmm3d_r2012a.c:(.text+0x12f23): undefined reference to `hfmm3dtriampftarg_'
collect2.exe: error: ld returned 1 exit status
I am using matlab R2020b.
  1 个评论
Debadipto
Debadipto 2023-9-1
Hello @Raksi, the github link that you've provided seems to be broken. Could you please verify and fix the link?

请先登录,再进行评论。

回答(1 个)

Narvik
Narvik 2023-9-13
Hi,
I understand that you are facing an issue while trying to use the mex command. The error ‘collect2.exe: error: Id returned 1 exit status usually occurs when winsock library is missing.
Please follow the troubleshooting steps provided in the MATLAB answer below:
Hope this helps!

类别

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