Error while building a c++ library interface

17 Ansichten (letzte 30 Tage)
CaG
CaG am 26 Nov. 2021
Kommentiert: Walter Roberson am 27 Nov. 2021
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?

Antworten (1)

Walter Roberson
Walter Roberson am 26 Nov. 2021
-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 Kommentare
CaG
CaG am 27 Nov. 2021
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 am 27 Nov. 2021
Something is misconfigured in definemylib . The library configuration section has a typing mistake, or something like that.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by