Why MEX cannot find library 'm' specified with the -l option?

25 次查看(过去 30 天)
I compiling some c files to make mex files in windows 10 64-bit operating system. but when I run it gives the following error:
Error using mex
MEX cannot find library 'm' specified with the -l option.
MEX looks for a file with one of the names:
m.lib
libm.lib
Please specify the path to this library with the -L option.
Error in make (line 17)
mex CC=g++ -lm get_full_speed.c
  7 个评论
Soham Patel
Soham Patel 2018-6-18
编辑:Walter Roberson 2018-6-18
mex -O -I/usr/include/opencv -lcxcore -lcv -lhighgui -c seeds2.cpp
mex -O mexSEEDS.cpp -I/usr/include/opencv -lcxcore -lcv -lhighgui seeds2.o
i am getting error in this file
MEX cannot find library 'cxcore' specified with the -l option.
MEX looks for a file with one of the names:
libcxcore.lib
cxcore.lib
Please specify the path to this library with the -L option.
can you help me to solved this error?
my opencv folder in c drive in download "C:\Users\Admin\Downloads\opencv"
can you help to write path of opencv?
Walter Roberson
Walter Roberson 2018-6-18
mex -O -I/usr/include/opencv -LC:/Users/Admin/Downloads/opencv -lcxcore -lcv -lhighgui -c seeds2.cpp
I suspect you will also need to change the -I/usr/include/opencv to something else, but where will depend on where the opencv include files got installed. possibly
mex -O -IC:/Users/Admin/Downloads/opencv/include -LC:/Users/Admin/Downloads/opencv -lcxcore -lcv -lhighgui -c seeds2.cpp

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2017-10-11
I see a hint that libm might be built in for MinGW. Try without the -lm

更多回答(1 个)

timo
timo 2018-3-28
编辑:Walter Roberson 2018-3-28
I have a similar issue . Didnt help not to use -l
>> mex -v -L"c:\MATLAB\R2018a\extern\lib\win64\mingw64" -liphlpapi MACAddress_mex.c
Verbose mode is on.
... Looking for compiler 'MinGW64 Compiler (C)' ...
... Looking for environment variable 'MW_MINGW64_LOC' ...Yes ('C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset').
... Looking for file 'C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset\bin\gcc.exe' ...Yes.
... Looking for folder 'C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset' ...Yes.
Found installed compiler 'MinGW64 Compiler (C)'.
Set PATH = C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset\bin;C:\MATLAB\R2018a\extern\include\win64;C:\MATLAB\R2018a\extern\include;C:\MATLAB\R2018a\simulink\include;C:\MATLAB\R2018a\lib\win64;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\TDM-GCC-64\bin;C:\MATLAB\R2018a\bin;C:\Users\timo\AppData\Local\Microsoft\WindowsApps;c:\SysGCC\mingw64\bin;
Set INCLUDE = C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset\include;;C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset\include;;
Set LIB = C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset\lib;;C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset\lib;;
Set MW_TARGET_ARCH = win64;win64;
Set LIBPATH = C:\MATLAB\R2018a\extern\lib\win64;C:\MATLAB\R2018a\extern\lib\win64;
Error using mex
MEX cannot find library 'iphlpapi' specified with the -l option.
MEX looks for a file with one of the names:
libiphlpapi.lib
iphlpapi.lib
Please specify the path to this library with the -L option.
  1 个评论
Walter Roberson
Walter Roberson 2018-3-28
You should be using the order
mex -v -L"c:\MATLAB\R2018a\extern\lib\win64\mingw64" MACAddress_mex.c -liphlpapi
However, I am not sure where you would find a MinGW compatible iphlpapi.lib . I see that it is normally provided with VS SDK
has iphlpapi.a . I am not sure if that implies that you would have that file in the directory that you -L'd . If so then
mex -v -L"c:\MATLAB\R2018a\extern\lib\win64\mingw64" MACAddress_mex.c iphlpapi.a

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by