Error using mex command

조회 수: 7 (최근 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