Error while building a c++ library interface
Show older comments
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?
Answers (1)
Walter Roberson
on 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 Comments
CaG
on 27 Nov 2021
Walter Roberson
on 27 Nov 2021
Something is misconfigured in definemylib . The library configuration section has a typing mistake, or something like that.
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!