How to fix Undefined symbols for architecture x86_64

조회 수: 19 (최근 30일)
Alex Manak
Alex Manak 2020년 7월 24일
댓글: Alex Manak 2020년 7월 24일
Im trying to connect a C program to Matlab, im launching the C program from terminal but i keep getting this error:
Undefined symbols for architecture x86_64:
"_engClose", referenced from:
_main in first-e0c476.o
"_engEvalString", referenced from:
_main in first-e0c476.o
"_engGetVariable", referenced from:
_main in first-e0c476.o
"_engOpen", referenced from:
_main in first-e0c476.o
"_engOutputBuffer", referenced from:
_main in first-e0c476.o
"_engPutVariable", referenced from:
_main in first-e0c476.o
"_mexPrintf_800", referenced from:
_main in first-e0c476.o
"_mxCreateDoubleMatrix_800", referenced from:
_main in first-e0c476.o
"_mxDestroyArray_800", referenced from:
_main in first-e0c476.o
"_mxGetNumberOfElements_800", referenced from:
_main in first-e0c476.o
"_mxGetPr_800", referenced from:
_main in first-e0c476.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
any help is greatly appreciated.

답변 (1개)

Abhishek gangwar
Abhishek gangwar 2020년 7월 24일
May be this issue is because of you do not a function named mexFunction in your MEX-file and that function needs to have a specific signature, if it is the senario, define that function in your MEX-file. Let me know if you are still having this issue after doing as I suggested.
  댓글 수: 4
Alex Manak
Alex Manak 2020년 7월 24일
By mex file, do you mean the mex folder
Alex Manak
Alex Manak 2020년 7월 24일
This is at the bottom of my mex.h file:
MEXFUNCTION_LINKAGE
/*
* mexFunction is the user-defined C routine that is called upon invocation
* of a MEX-function.
*/
void mexFunction(
int nlhs, /* number of expected outputs */
mxArray *plhs[], /* array of pointers to output arguments */
int nrhs, /* number of inputs */
const mxArray *prhs[] /* array of pointers to input arguments */
);
#endif /* mex_h */

댓글을 달려면 로그인하십시오.

카테고리

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