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

1 次查看(过去 30 天)
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.

回答(3 个)

Jan
Jan 2012-10-30
编辑:Jan 2012-10-30
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 个评论
dave
dave 2012-11-1
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 2012-11-12
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.

请先登录,再进行评论。


dave
dave 2012-10-31
编辑:dave 2012-10-31
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 个评论
Jan
Jan 2012-10-31
You have successfully installed OpenWatcom under R2011b?! How did you do this?
dave
dave 2012-11-1
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.

请先登录,再进行评论。


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

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by