0

I am really in a very bad situation with my project. It is working with my 32bit-desktop and with the same versions of MATLAB (R2012a) and Visual Studio 2010 Express but it is not working on 64-bit laptop. Last error is below: while I am trying to execute this one:

function make_cvlib()
%  make_cvlib -- Make the cvlib_mex in windows. It probably will
%  work as well in Linux/Mac with only minor changes
%
%  Author:  Joaquim Luis
%  Date:    07-Sept-2006


% Adjust for your own path
INCLUDE_CV = '''C:\Program Files\OpenCV\cv\include''';
INCLUDE_CXCORE = '''C:\Program Files\OpenCV\cxcore\include''';
LIB_CV = '''C:\Program Files\OpenCV\lib\cv.lib''';
LIB_CXCORE = '''C:\Program Files\OpenCV\lib\cxcore.lib''';

% -------------------------- Stop editing ---------------------------
include_cv = ['-I' INCLUDE_CV ' -I' INCLUDE_CXCORE];
library_cv = [LIB_CV ' ' LIB_CXCORE];

if (ispc)
    opt_cv = '-O -DWIN64 -DDLL_CV100 -DDLL_CXCORE100';
else
    opt_cv = '-O';
end

cmd = ['mex cvlib_mex.c' ' ' include_cv ' ' library_cv ' ' opt_cv];        
eval(cmd)

Here is the error:

>> make_cvlib
   Creating library C:\Users\hp\AppData\Local\Temp\mex_cj81oV\templib.x and object C:\Users\hp\AppData\Local\Temp\mex_cj81oV\templib.exp 
cvlib_mex.obj : error LNK2019: unresolved external symbol cvAddS referenced in function cvSubS 
cvlib_mex.obj : error LNK2019: unresolved external symbol cvEllipse referenced in function cvEllipseBox 
cvlib_mex.obj : error LNK2019: unresolved external symbol cvSetData referenced in function localSetData 
cvlib_mex.obj : error LNK2019: unresolved external symbol cvGetSeqElem referenced in function JapproxPoly 
cvlib_mex.obj : error LNK2019: unresolved external symbol cvReleaseMemStorage referenced in function JapproxPoly 
...(65 more)
cvlib_mex.mexw64 : fatal error LNK1120: 69 unresolved externals 

  C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Link of 'cvlib_mex.mexw64' failed. 

Error using mex (line 206)
Unable to complete successfully.

Error in make_cvlib (line 26)
eval(cmd)

Please show some points that I missed...

  • From what I remember, VS 2010 Express cannot compile 64-bit applications on its own (maybe if you add some visual-studio tag, you get more knowledgeable people to tell you for sure).. – Amro Jun 02 '12 at 03:46
  • Here's a couple of related questions: [Why does Visual Studio not link correctly as a matlab mex file against the rundll?](http://stackoverflow.com/q/10582764/97160), [Load Library error Matlab](http://stackoverflow.com/q/9475963/97160) – Amro Jun 02 '12 at 03:53
  • Last comment I promise. There's an excellent openCV-wrapper library for MATLAB ([mexopencv](http://www.cs.stonybrook.edu/~kyamagu/mexopencv/)) that I've personally tested. Though its using OpenCV 2.x instead of the now ancient 1.x version you seem to be using – Amro Jun 02 '12 at 04:02

0 Answers0