-
Notifications
You must be signed in to change notification settings - Fork 318
Invalid MEX-file #76
Comments
this is my @echo off
rem MSVC100OPTS.BAT
rem
rem Compile and link options used for building MEX-files
rem using the Microsoft Visual C++ compiler version 10.0
rem
rem $Revision: 1.1.6.3 $ $Date: 2011/03/09 05:35:12 $
rem Copyright 2007-2009 The MathWorks, Inc.
rem
rem StorageVersion: 1.0
rem C++keyFileName: MSVC100OPTS.BAT
rem C++keyName: Microsoft Visual C++ 2010
rem C++keyManufacturer: Microsoft
rem C++keyVersion: 10.0
rem C++keyLanguage: C++
rem
rem ********************************************************************
rem General parameters
rem ********************************************************************
set MATLAB=%MATLAB%
set VSINSTALLDIR=F:\Program Files\Microsoft Visual Studio 10.0
set VCINSTALLDIR=%VSINSTALLDIR%\VC
rem In this case, LINKERDIR is being used to specify the location of the SDK
set LINKERDIR=C:\Program Files\Microsoft SDKs\Windows\v7.0A\
set PATH=%VCINSTALLDIR%\bin;%VCINSTALLDIR%\VCPackages;%VSINSTALLDIR%\Common7\IDE;%VSINSTALLDIR%\Common7\Tools;%LINKERDIR%\bin;%MATLAB_BIN%;F:\Program Files\opencv\build\x86\vc10\bin;F:\Program Files\opencv\build\common\tbb\ia32\vc10;%PATH%
set INCLUDE=%VCINSTALLDIR%\INCLUDE;%VCINSTALLDIR%\ATLMFC\INCLUDE;%LINKERDIR%\include;F:\Program Files\opencv\build\include;F:\Program Files\opencv\build\include\opencv;F:\Program Files\opencv\build\include\opencv2;%INCLUDE%
set LIB=%VCINSTALLDIR%\LIB;%VCINSTALLDIR%\ATLMFC\LIB;%LINKERDIR%\lib;%MATLAB%\extern\lib\win32;F:\Program Files\opencv\build\x86\vc10\lib;F:\Program Files\opencv\build\x86\vc10\bin;%LIB%
set MW_TARGET_ARCH=win32
rem ********************************************************************
rem Compiler parameters
rem ********************************************************************
set COMPILER=cl
set COMPFLAGS=/c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE/DMATLAB_MEX_FILE /nologo /MD
set OPTIMFLAGS=/O2 /Oy- /DNDEBUG
set DEBUGFLAGS=/Z7
set NAME_OBJECT=/Fo
rem ********************************************************************
rem Linker parameters
rem ********************************************************************
set LIBLOC=%MATLAB%\extern\lib\win32\microsoft
set LINKER=link
set LINKFLAGS=/dll /export:%ENTRYPOINT% /LIBPATH:"%LIBLOC%" opencv_calib3d231.lib opencv_contrib231.lib opencv_core231.lib opencv_features2d231.lib opencv_flann231.lib opencv_gpu231.lib opencv_highgui231.lib opencv_imgproc231.lib opencv_legacy231.lib opencv_ml231.lib opencv_objdetect231.lib opencv_ts231.lib opencv_video231.lib libmx.lib libmex.lib libmat.lib /MACHINE:X86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /manifest /incremental:NO /implib:"%LIB_NAME%.x" /MAP:"%OUTDIR%%MEX_NAME%%MEX_EXT%.map"
set LINKOPTIMFLAGS=
set LINKDEBUGFLAGS=/debug /PDB:"%OUTDIR%%MEX_NAME%%MEX_EXT%.pdb"
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT=/out:"%OUTDIR%%MEX_NAME%%MEX_EXT%"
set RSP_FILE_INDICATOR=@
rem ********************************************************************
rem Resource compiler parameters
rem ********************************************************************
set RC_COMPILER=rc /fo "%OUTDIR%mexversion.res"
set RC_LINKER=
set POSTLINK_CMDS=del "%LIB_NAME%.x" "%LIB_NAME%.exp"
set POSTLINK_CMDS1=mt -outputresource:"%OUTDIR%%MEX_NAME%%MEX_EXT%;2" -manifest "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest"
set POSTLINK_CMDS2=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest"
set POSTLINK_CMDS3=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.map" |
You don't have a problem in mex configuration if you succeed to compile. Make sure you have the correct System Path. |
According to Google Translate, the error message indicates that MATLAB failed to find the required OpenCV DLLs. Set your |
Thank you very much for your replay! |
Can you try finding missing dependency with Dependency Walker? Here is a detailed use for MEX files: http://www.mathworks.com/support/solutions/en/data/1-2RQL4L/ |
Thank you ! i will try this method . |
I reinstall the VS and opencv2.3.1,then the VS2010 can work sucessfuly, but matlab can not succeed to compile. the error is
what can i do for this problem? Looking forward to your reply |
Now i used the Opencv2.4.3,and can compilation sucessfully, but matlab always crashes .
And
|
I compiled mexopencv again, then when i run the example
|
Is there any reason you need to use the older OpenCV release? For OpenCV 2.4.0-2.4.5, make sure you use mexopencv 2.4.0. Also, for that old release of mexopencv, you might need to manually modify |
Thank you very much.
|
Can you change |
I found the "mexopt.bat" with the "mex-v",and delete the" D_SECURE_SCL" in the "meopt.bat". But the error is still exist.What else can i do ? |
You must recompile mexopencv codes. For that version, |
Yes, i have recompiled the codes. |
You need to have either |
I used the VS2010 as the compiler, if set the "D_SECURE_SCL=1 "? |
I set the "D_SECURE_SCL=1 " and recompiled.
|
I don't know why, but it seems you have OpenCV dll's installed to |
Thank you for reply! |
I have the" Computer Vision Toolbox 4.1 win32 "from Mathworks in Matlab2011b. |
Computer Vision Toolbox is incompatible with mexopencv, since it doesn't offer header/library files for its own OpenCV. I don't know how to fix this in Windows platform, since I'm not aware of Linux's |
afaik, MATLAB does not install anything in Right now both you and the Computer Vision toolbox are using the same OpenCV version 2.3.1. Luckily OpenCV files contain the version number in their names; The loader will be looking for files named On my machine running R2013a, the CompVision toolbox seems to be using OpenCV dlls v2.4.2, while I compiled mexopencv against v2.4.5 and everything is running fine with no conflict. Bottom line is: use the latest stable OpenCV version with mexopencv and you will see fewer problems :) There is no reason to be using old releases |
XP(sp3)+VS2010+R2011b+opencv2.3.1
i always have the problem that
when run the examples, and i tried everything in the instructions. I dont know why?
The text was updated successfully, but these errors were encountered: