mex compliation problem with include paths for file mexopts.bat

4 views (last 30 days)
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 Comments
Muhammad Ali Qadar
Muhammad Ali Qadar on 29 Aug 2013
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 on 30 Aug 2013
Edited: Jan on 30 Aug 2013
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"

Sign in to comment.

Answers (2)

turab
turab on 30 Aug 2013
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.
  2 Comments
Ken Atwell
Ken Atwell on 30 Aug 2013
This error is unrelated to what Muhammad is reporting -- I recommend you begin a new topic.

Sign in to comment.


Ken Atwell
Ken Atwell on 30 Aug 2013
Edited: Jan on 30 Aug 2013
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 Comments
Muhammad Ali Qadar
Muhammad Ali Qadar on 31 Aug 2013
@Jan Simon, @Ken Atwell, is there still anything that I can do???
Muhammad Ali Qadar
Muhammad Ali Qadar on 31 Aug 2013
Also My Opencv with Visual Studio 10 Is working fine I have run an example but with matlab problem is not getting solved

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!