mex compliation problem with include paths for file mexopts.bat

3 次查看(过去 30 天)
HI,
I am really very Frustrated of doing mex stuff, I am trying for more than 3 Days I know there is very little thing that need to be done to make mex displayImage.cpp to work
I have installed VS10, SDK7.1, MAtlab2012a,opencv 2.3, Everything is fine
Also I am not able to run mex-setup again it giving me following error
mex-setup
Usage:
MEX [option1 ... optionN] sourcefile1 [... sourcefileN]
[objectfile1 ... objectfileN] [libraryfile1 ... libraryfileN]
Use the -help option for more information, or consult the MATLAB API Guide.
C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: No file names given.
Undefined function or variable 'setup'
and if I run the cpp File it gives me following error
mex displayImage.cpp
displayImage.cpp
displayImage.cpp(5) : fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Compile of 'displayImage.cpp' failed.
Error using mex (line 206)
Unable to complete successfully.
even stdio.h is inside the folder of my current working Directory.
Looking forward....
Thanks and regards
  15 个评论
Muhammad Ali Qadar
Muhammad Ali Qadar 2013-8-29
one thing I have seen that when I run mex -setup then it wipe out all paths that are newly added to it, and therefore it can not find cv.h or else things
Jan
Jan 2013-8-30
编辑:Jan 2013-8-30
Please test, if cv.h is where you expect it:
exist('C:\opencv\ch.h', 'file')
Try the quotes instead of < and >:
#include "cv.h"

请先登录,再进行评论。

回答(2 个)

turab
turab 2013-8-30
i have the exact same problem. i have also read on a page that matlab 2012a and visual studio 2010 donot support initially there is a patch for this purpose i have downloaded this patch and placed in the matlabroot but the problem remains the same the error i am constantly getting is : mex displayimg.cpp Error: Could not find the compiler "cl" on the DOS path. Use mex -setup to configure your environment properly.
C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Unable to locate compiler.
plz give me some helpful suggestions thanx.

Ken Atwell
Ken Atwell 2013-8-30
编辑:Jan 2013-8-30
I would not reinstall MATLAB or Visual Studio; you have a path problem that reinstalling will not solve.
Are you sure cv.h is in C:\opencv, and not a subfolder under it? I am not familiar with OpenCV, but I would try:
mex -IC:\opencv\include\opencv displayImage.cpp
If that fails, open the Explorer and locate the name of the folder where cv.h is found. Wherever that is, put that folder name (not filename) as the -I parameter to MEX.
And, yes, if you rerun "mex -setup", it will clobber any customization you may have made to mexopt.bat. In general, I would only edit this file as a last resort.
  5 个评论
Muhammad Ali Qadar
Muhammad Ali Qadar 2013-8-31
Also My Opencv with Visual Studio 10 Is working fine I have run an example but with matlab problem is not getting solved

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by