User`s manual
Troubleshooting
1-35
MathWorks Technical Support Web site at http://www.mathworks.com/
support
.
Problem 1 - Compiling a MathWorks Program Fails
The most common configuration problem in creating C MEX-files on UNIX
involves using a non-ANSI C compiler, or failing to pass to the compiler a flag
that tells it to compile ANSI C code.
A reliable way of knowing if you have this type of configuration problem is if
the header files supplied by The MathWorks generate a string of syntax errors
when you try to compile your code. See “Building MEX-Files” on page 1-11 for
information on selecting the appropriate options file or, if necessary, obtain an
ANSI C compiler.
Problem 2 - Compiling Your Own Program Fails
A second way of generating a string of syntax errors occurs when you attempt
to mix ANSI and non-ANSI C code. The MathWorks provides header and
source files that are ANSI C compliant. Therefore, your C code must also be
ANSI compliant.
Other common problems that can occur in any C program are neglecting to
include all necessary header files, or neglecting to link against all required
libraries.
Problem 3 - MEX-File Load Errors
If you receive an error of the form
Unable to load mex file:
??? Invalid MEX-file
MATLAB is unable to recognize your MEX-file as being valid.
MATLAB loads MEX-files by looking for the gateway routine,
mexFunction. If
you misspell the function name, MATLAB is not able to load your MEX-file and
generates an error message. On Windows, check that you are exporting
mexFunction correctly.
On some platforms, if you fail to link against required libraries, you may get an
error when MATLAB loads your MEX-file rather than when you compile your
MEX-file. In such cases, you see a system error message referring to unresolved