Why I couldn't create mex function that realize C function that call multiple functions in multiple files?
조회 수: 2 (최근 30일)
이전 댓글 표시
I have C function that call other functions from multiple C files therefore i have some H files. I setup my compiler: Microsoft Software Development Kit (SDK) 7.1. I create my MEX source file, so how it is described in help. I try to build mex function by typing this:
mex 'codegen\lib\quadraticSolver\quadraticSolver.c' ...
'codegen\lib\quadraticSolver\quadraticSolver_initialize.c' ...
'codegen\lib\quadraticSolver\quadraticSolver_terminate.c' ...
'codegen\lib\quadraticSolver\rt_nonfinite.c' ...
'codegen\lib\quadraticSolver\rtGetNaN.c' ...
'codegen\lib\quadraticSolver\rtGetInf.c' ...
'codegen\lib\quadraticSolver\quadraticSolver.h' ...
'codegen\lib\quadraticSolver\quadraticSolver_initialize.h' ...
'codegen\lib\quadraticSolver\quadraticSolver_terminate.h' ...
'codegen\lib\quadraticSolver\rt_nonfinite.h' ...
'codegen\lib\quadraticSolver\rtGetNaN.h' ...
'codegen\lib\quadraticSolver\rtGetInf.h' ...
'codegen\lib\quadraticSolver\rtwtypes.h' ...
'codegen\lib\quadraticSolver\quadraticSolver_types.h';
And this error popped up:
codegen\lib\quadraticSolver\quadraticSolver.h : fatal error LNK1107: invalid or corrupt file: cannot read at 0x23D
C:\PROGRA~1\MATLAB\R2013A\BIN\MEX.PL: Error: Link of 'quadraticSolver.mexw64' failed.
Error using mex (line 206) Unable to complete successfully.
Error in mex_maker (line 1) mex 'codegen\lib\quadraticSolver\quadraticSolver.c' ...
Why?
댓글 수: 0
채택된 답변
Kaustubha Govind
2013년 5월 17일
It appears that this is code generated using MATLAB Coder - is this correct? If yes, it appears the generated code is meant to be compiled into a library (the path codegen\lib implies that), which means that the files will not have the mexFunction entry-point, which is required to compile them into a MEX-file. You may just want to run the .bat (.sh on Linux) file that should be present under codegen\lib\quadraticSolver to re-compile the code into a library.
Also, in general, you don't have to specify header files with the mex command, just specify the source files and specify the location of header files using the -I option.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!