Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.33/5 (2 votes)
See more:
hi i'm using matlab 2013a x64 and win7 x64 . install the opencv path (C:\opencv)

Compile Error :

>> mex -LC:\opencv\build\x64\vc11\lib -IC:\opencv\build\include\opencv -lcv -lcxcore me_HaarDetectOpenCV.cpp
 
Warning: MEX could not find the library "cv" specified with -l option. 
         MEX looked for a file with one of the names: 
               cv.lib 
               libcv.lib 
         MEX looked for the library in the following directories: 
               D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\LIB\amd64 
               D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\LIB\amd64 
               C:\Program Files (x86)\Windows Kits\8.0\lib\win8\um\x64 
               D:\Program Files\MATLAB\R2013a\extern\lib\win64 
               D:\Program Files\MATLAB\R2013a\extern\lib\win64\microsoft 
               C:\opencv\build\x64\vc11\lib 
 
 
Warning: MEX could not find the library "cxcore" specified with -l option. 
         MEX looked for a file with one of the names: 
               cxcore.lib 
               libcxcore.lib 
         MEX looked for the library in the following directories: 
               D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\LIB\amd64 
               D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\LIB\amd64 
               C:\Program Files (x86)\Windows Kits\8.0\lib\win8\um\x64 
               D:\Program Files\MATLAB\R2013a\extern\lib\win64 
               D:\Program Files\MATLAB\R2013a\extern\lib\win64\microsoft 
               C:\opencv\build\x64\vc11\lib 
 
   Creating library C:\Users\AsUs\AppData\Local\Temp\mex_47j5SQ\templib.x and object C:\Users\AsUs\AppData\Local\Temp\mex_47j5SQ\templib.exp 
me_HaarDetectOpenCV.obj : error LNK2019: unresolved external symbol cvCreateImage referenced in function mexFunction 
me_HaarDetectOpenCV.obj : error LNK2019: unresolved external symbol cvReleaseImage referenced in function mexFunction 
me_HaarDetectOpenCV.obj : error LNK2019: unresolved external symbol cvCreateMemStorage referenced in function mexFunction 
me_HaarDetectOpenCV.obj : error LNK2019: unresolved external symbol cvReleaseMemStorage referenced in function mexFunction 
me_HaarDetectOpenCV.obj : error LNK2019: unresolved external symbol cvGetSeqElem referenced in function mexFunction 
me_HaarDetectOpenCV.obj : error LNK2019: unresolved external symbol cvLoad referenced in function mexFunction 
me_HaarDetectOpenCV.obj : error LNK2019: unresolved external symbol cvEqualizeHist referenced in function mexFunction 
me_HaarDetectOpenCV.obj : error LNK2019: unresolved external symbol cvReleaseHaarClassifierCascade referenced in function mexFunction 
me_HaarDetectOpenCV.obj : error LNK2019: unresolved external symbol cvHaarDetectObjects referenced in function mexFunction 
me_HaarDetectOpenCV.mexw64 : fatal error LNK1120: 9 unresolved externals 
 
  D:\PROGRA~2\MATLAB\R2013A\BIN\MEX.PL: Error: Link of 'me_HaarDetectOpenCV.mexw64' failed. 
 
Error using mex (line 206)
Unable to complete successfully. 
>> 


how fix error and compile (created me_HaarDetectOpenCV.mexw64)??
Posted
Updated 14-Dec-13 6:45am
v3
Comments
Richard MacCutchan 14-Dec-13 13:03pm    
You need to provide the paths to the directory(ies) that contain these libraries. Given the number of questions you have asked on this subject you may find it faster to read the documentation.
Richard MacCutchan 14-Dec-13 13:04pm    
Mathworks even has a support forum to help you.

1 solution

What it looks like in the line:

-LC:\opencv\build\x64\vc11\lib -IC:\opencv\build\include\opencv -lcv -lcxcore me_HaarDetectOpenCV.cpp

is that this is your compile execution line to compile the file: 'me_HaarDetectOpenCV.cpp'
and you are attempting to let the compiler know where the libraries are located:

-LC:\opencv\build\x64\vc11\lib but haven't specified a library file or files in particular,

and that you are attempting, in particular, to include the header file(s):

'opencv' and that you want to use the -lcv and -lcxcore options.

The compiler has interpreted this differently. The compiler saw:

"-IC:\opencv\build\include\opencv" as the library file that you wanted to attach and load,
as well as 'cv' and 'cxcore', and was seeing the -1 or the -l as the option code for 'cv' and 'cxcore'.

My first question is: in the option '-lcv', is the character after the hyphen(-) a one(1) or a lower case L(l), and should they not be 'i' for include, or is it 'l' for library, or is it '1' for some option number one?

So maybe separate command lines should have looked something like the below in a batch file of some kind:

-LC:\opencv\build\x64\vc11\lib cv.lib cxcore.lib libcxcore.lib
-IC:\opencv\build\include\opencv -i cv.h -i cxcore.h -i libcxcore.h

I don't really know, just a guess.
 
Share this answer
 
Comments
Richard MacCutchan 15-Dec-13 4:08am    
And quite wrong. The -L option gives the search path for the linker phase. The -I option gives the search path for the compiler to locate included files. The -l options give the names of library files to be used in the linker phase.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900