MATLAB Compiler | ![]() ![]() |
Troubleshooting
This section identifies some of the more common problems that can occur when installing and configuring the MATLAB Compiler.
mex Troubleshooting
Out of Environment Space Running mex or mbuild. On Windows 98 systems, the mex
and mbuild
scripts require more than the default amount of environment space. If you get the error, out of environment space
, add this line to your config.sys
file.
On Windows Me systems, if you encounter this problem and are using the MATLAB add-in for Visual Studio, follow the procedure in Configuring on Windows 98 and Windows Me Systems.
Non-ANSI C Compiler on UNIX. A common configuration problem in creating C MEX-files on UNIX involves using a non-ANSI C compiler. You must use an ANSI C compiler.
DLLs Not on Path on Windows. MATLAB will fail to load MEX-files if it cannot find all DLLs referenced by the MEX-file; the DLLs must be on the DOS path or in the same directory as the MEX-file. This is also true for third-party DLLs.
Segmentation Violation or Bus Error. If your MEX-file causes a segmentation violation or bus error, there is most likely a problem with the MATLAB Compiler. Contact Technical Support at The MathWorks at support@mathworks.com
.
Generates Wrong Answers. If your program generates the wrong answer(s), there are several possible causes. There could be an error in the computational logic or there may be a defect in the MATLAB Compiler. Run your original M-file with a set of sample data and record the results. Then run the associated MEX-file with the sample data and compare the results with those from the original M-file. If the results are the same, there may be a logic problem in your original M-file. If the results differ, there may be a defect in the MATLAB Compiler. In this case, send the pertinent information via e-mail to support@mathworks.com
.
mex Works from Shell But Not from MATLAB (UNIX). If the command
works from the UNIX shell prompt but does not work from the MATLAB prompt, you may have a problem with your .cshrc
file. When MATLAB launches a new C shell to perform compilations, it executes the .cshrc
script. If this script causes unexpected changes to the PATH
, an error may occur. You can test whether this is true by performing a
prior to launching MATLAB. If this works correctly, then you should check your .cshrc
file for problems setting the PATH
.
Cannot Locate Your Compiler (PC). If mex
has difficulty locating your installed compilers, it is useful to know how it goes about finding compilers. mex
automatically detects your installed compilers by first searching for locations specified in the following environment variables:
BORLAND
for Borland C++ Compiler, Version 5.3
WATCOM
for the Watcom C/C++ Compiler
MSVCDIR
for Microsoft Visual C/C++, Version 5.0, 6.0, or 7.0
Next, mex
searches the Windows registry for compiler entries. Note that Watcom does not add an entry to the registry. Digital Fortran does not use an environment variable; mex
only looks for it in the registry.
Internal Error When Using mex -setup (PC). Some antivirus software packages such as Cheyenne AntiVirus and Dr. Solomon may conflict with the mex -setup
process. If you get an error message during mex -setup
of the following form
then you need to disable your antivirus software temporarily and rerun mex -setup
. After you have successfully run the setup
option, you can reenable your antivirus software.
Verification of mex Fails. If none of the previous solutions addresses your difficulty with mex
, contact Technical Support at The MathWorks at support@mathworks.com
.
![]() | MATLAB Compiler Verification | Troubleshooting the Compiler | ![]() |