Why do I get these error messages when using "MexMe"?

1 view (last 30 days)
I'd like to use MexMe to create mex-files automatically. But each time I run TestMexMe.m, it gives me a host of error messages (20-30) concerning the file mydouble.c.
These are a few of the error messages I get using the Lcc compiler:
>> TestMexMe
Error mydouble.c: 33 illegal statement termination
Error mydouble.c: 33 skipping `const'
Error mydouble.c: 33 illegal use of type name `mxArray'
Error mydouble.c: 33 undeclared identifier `x_ptr'
Error mydouble.c: 33 operands of * have illegal types `incomplete struct mxArray_tag defined at C:\PROGRA~1\MATLAB\R2011B\extern\include\matrix.h 299' and `int'
...etc...
C:\PROGRA~1\MATLAB\R2011B\BIN\MEX.PL: Error: Compile of 'mydouble.c' failed.
Error using mex (line 206)
Unable to complete successfully.
Error in TestMexMe (line 25)
mex mydouble.c
Using MS Visual C++ compiler I get similar errors (all of them have to do with mmydouble.c).
Any idea what might be causing these issues?
ps.: I'm using the R 2011 b version on WinXP.
  2 Comments
Jan
Jan on 30 Oct 2012
What did the author of this tool reply to your email?
dave
dave on 30 Oct 2012
Unfortunately he hasn't replied yet..

Sign in to comment.

Answers (3)

Jan
Jan on 30 Oct 2012
Edited: Jan on 30 Oct 2012
These are obvioulsy errors in the mydouble.c program and not caused by MexMe. When you post teh source of this function, we could find the problem. What do you find in line 33?
  14 Comments
dave
dave on 1 Nov 2012
In the file mydouble.c there's no line break between the words "return" and "values". I'm sorry that I'm causing so much trouble with this problem, but that's (at least partially) due to the fact that I'm still pretty new to Matlab and its components.
Anyway...thank you very much for taking a look at it, Jan ;)
Jan
Jan on 12 Nov 2012
See my comments at FEX: MexMe. The automatically created code has C++ style, but the Windows compiler assumes C according to the file extension. Either rename the file to .cpp (e.g. by modifying MexMe.m), or resort the lines such that the declarations of variables are move before the first line of calculations.
I do not think that MexMe can create Mex-files "in no time" as advertised, but it is much faster than even a very experienced C-Mex-programmer. It must be expected, that automatically generated code demands for a manual fine tuning.

Sign in to comment.


dave
dave on 31 Oct 2012
Edited: dave on 31 Oct 2012
I spent a couple of hours today searching through C/C++ forums for the solution to the error message I get in line 33 - without any real success. Additionally I installed open watcom c/c++ compiler, to see if mexing the file works with this one - it doesn't.
Couldn't it be that working with MexMe just doesn't work for me because I use Windows??
In MexMes's "comments and rating" section there is actually a quote of another MexMe user saying something about using MexMe on Windows:
"Awesome! Worked as expected for me in my usual Linux environment. Tried to share with a coworker on Windows who couldn't get the c file mexed. I am not as familiar with the Visual Studio compiler, so I haven't been able to figure it out (we have both successfully mexed files in the past)."
  2 Comments
Jan
Jan on 31 Oct 2012
You have successfully installed OpenWatcom under R2011b?! How did you do this?
dave
dave on 1 Nov 2012
There was nothing special about the installation - I just downloaded the file open-watcom-c-win32-1.9.exe from here, installed it, ran mex -setup in Matlab and selected the Open WATCOM C++ compiler.

Sign in to comment.


dave
dave on 6 Nov 2012
Jan, do you get the same errors/problems when running Mexme?

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!