Why do I get these error messages when using "MexMe"?
Show older comments
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.
Answers (3)
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
on 30 Oct 2012
dave
on 30 Oct 2012
José-Luis
on 30 Oct 2012
I think #include mat.h is missing.
Jan
on 30 Oct 2012
@Jose: mat.h is included by mex.h. Anyhow, I do noth think that the problem is related to a missing MAT-file access.
José-Luis
on 30 Oct 2012
My bad.
dave
on 30 Oct 2012
@Mike: When the C-compiler is confused in line 33, the following lines will increase the confusion. Therefore care for the first error at first and see if the others vanish automatically. On the other hand: The line 32 might contain the problem already: "Es fehlt ';' vor 'const'" seems like the line before 33 is not terminated (translation: missing ";" before const).
You can create English error messages, when you install the English version of the compiler. But fortunately some people are talking German in this forum, although Oleg thought it is Dutch. (I never forget such details, Oleg :-) )
I'm getting nervous. As soon as you show us the preceeding lines of the created C-files, we had a chance to find the problem. The bunch of follwoing error messages is really useless and meaningless. Therefore we currently have a signal to noise ratio in this thread of about 2 lines to 400 lines.
Please, Mike, post what you find in line 32 of the created programs and concentrate on the first compiler error only. Perhaps MexMe creates C++ source and LCC is a C-compiler only, while GCC can handle both.
dave
on 1 Nov 2012
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.
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!