Error while building a c++ library interface

조회 수: 5 (최근 30일)
CaG
CaG 2021년 11월 26일
댓글: Walter Roberson 2021년 11월 27일
I am trying to build an interface to a C++ library I wrote following the procedure described here.
I define the missing constrcut and I receive no error whatsoever. However, when giving the command
build(definemylib)
I receive the following error
Error using clibgen.internal.buildHelper (line 75)
Build failed with error:
'C:/ProgramData/MATLAB/SupportPackages/R2021b/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-LC:\Program Files\MATLAB\R2021b\extern\lib\win64\mingw64
C:/ProgramData/MATLAB/SupportPackages/R2021b/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
'.
Error in clibgen.LibraryDefinition/build (line 1406)
clibgen.internal.buildHelper(obj, obj.LibraryInterface, '', directBuild);
I actually do not undestand the error, since the files that cannot be found are there in the indicated folders. What am I doing wrong?

답변 (1개)

Walter Roberson
Walter Roberson 2021년 11월 26일
-l-LC:\Program Files\MATLAB\R2021b\extern\lib\win64\mingw64
That is missing a space and also some other information.
There are two different options.
The -l (lower-case L) option needs to be followed by the name of a library to link into the object. An example of that is -llibMatlabDataArray which is saying that the libMatlabDataArray library needs to be located and linked into the object.
The -L (upper-case L) option needs to be followed by a directory name. The option indicates that the linker should add the given directory to the list of directories to search for libraries whose name have been given by -l (lower-case L) options.
Note that it is recommended that directory names with spaces in them be enclosed in double-quotes,
-L"C:\Program Files\MATLAB\R2021b\extern\lib\win64\mingw64"
  댓글 수: 2
CaG
CaG 2021년 11월 27일
Thank you for the answer. I know this. However, I did not write this line of code. I do not add that library folder manually. It is something created automatically inside the clibgen.internal.build command on which I have not control. I'm starting to think that maybe I am not giving all the inputs or there is something wrong with mingw64.
Walter Roberson
Walter Roberson 2021년 11월 27일
Something is misconfigured in definemylib . The library configuration section has a typing mistake, or something like that.

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

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by