Integrating C++ into MATLAB
Show older comments
>> build(definerectangle1)
正在编译接口文件 "rectangle1Interface.dll"。
错误使用 clibgen.internal.buildHelper (line 61)
编译失败并显示错误:
'C:/ProgramData/MATLAB/SupportPackages/R2019a/3P.instrset/mingw_w64.instrset/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
cannot find -l-LE:\Matlab2019a\extern\lib\win64\mingw64
C:/ProgramData/MATLAB/SupportPackages/R2019a/3P.instrset/mingw_w64.instrset/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
cannot find -llibMatlabDataArray
collect2.exe: error: ld returned 1 exit status
'。
出错 clibgen.LibraryDefinition/build (line 413)
clibgen.internal.buildHelper(obj, obj.LibraryInterface, '', directBuild);
Answers (1)
Anjaneyulu Bairi
on 3 Dec 2024
Hi,
The error message you are encountering seems to be a issue with linking libraries during the build process. Here are some steps to troubleshoot the issue:
- Make sure the MATLAB Compielr is correctly setup and configured properly. Run below command to check the setup and ensure the MinGW-w64 compiler is installed and selected.
mex -setup
- In error message, it says wrong usage of buildHelper. Refer the following documenation link to know the correct usage of buildHelper function in your code: https://www.mathworks.com/help/matlab/ref/clibgen.librarydefinition.build.html
- For more information on publishing a MATLAB Interface to a C++ Library, refer the following official documenation link: https://www.mathworks.com/help/matlab/matlab_external/steps-to-publish-a-matlab-interface-to-a-c-library.html
Hope it helps!
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!