Why do I receive multiple compile-time errors that reference MATLAB header files while using the MEX command?
1 view (last 30 days)
Show older comments
MathWorks Support Team
on 27 Jun 2009
Commented: guygyuggfff
on 17 Jun 2021
I am trying to compile a MEX-file, and I receive errors from the C compiler as it runs through MATLAB header files such as mex.h. For example:
Error yprime.c: C:\Matlab701\extern\include\mex.h: 63 syntax error; found `mxArray' expecting `}'
Error yprime.c: C:\Matlab701\extern\include\mex.h: 63 skipping `mxArray' `*' `*' `variable'
Error yprime.c: C:\Matlab701\extern\include\mex.h: 64 unrecognized declaration
Error yprime.c: C:\Matlab701\extern\include\mex.h: 75 syntax error; found `mxFunctionPtr' expecting `}'
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
These errors may be caused by the existence of header files that have the same name as MATLAB header files. As a result, these header files are being included instead of the desired MATLAB header files. To work around this issue, check if you have any header files in your current working directory (or include directories) that have the same name as those in $MATLAB\extern\include (where $MATLAB is the directory where you have installed MATLAB). Any such files will need to be renamed or moved.
0 Comments
More Answers (0)
See Also
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) 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!