After installing my stand-alone application, why do I get the error : "ERROR: Failed to find MEX-File on path : foo/bar/library.dll."?

7 views (last 30 days)
I installed my MATLAB Compiler-generated application and the Math and Graphics Runtime Libraries on a system that does not have MATLAB installed. When I try to run the executable, I get the following error:
Failed to find MEX-File on path : foo/bar/library.dll.
It appears that some MATLAB functions are dependent on MEX-files that are not found by my stand-alone application. Some other functions correctly find the required DLL's in the PATH.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
During program generation, the MATLAB Compiler embeds the absolute path to MEX-files inside the application. When the application is run on another machine, it will look in a predefined location for required MEX libraries.
The MGLINSTALLER adds commonly used MEX-files to a target machine. However, some MEX-files are not distributed. These may include:
1. User generated MEX-files
2. MEX-files hidden in private directories
3. MEX-files included with MATLAB toolboxes that were not shipped on the installation CD
In order to ensure proper execution of a distributed application, MEX-files of the aforementioned type must be manually installed along with the program. The files must be placed in the 'bin' directory, which is the same directory as the executable.
MEX-files installed under a private directory in MATLAB must also be installed in a private directory with the distributed application. Here is an example:
If your program makes use of MEX-files found on the development machine in the following location:
$MATLAB\toolbox\foo\bar1.dll
$MATLAB\toolbox\foo\private\bar2.dll
(where $MATLAB is the root MATLAB installation directory)
then the files 'bar1.dll' and 'bar2.dll' must be installed with the application at the following location:
$APPLICATION\foobar.exe
$APPLICATION\bin\bar1.dll
$APPLICATION\bin\foo\private\bar2.dll
(where $APPLICATION is the root application installation directory)
To determine the MEX-files used by an application, look for generated files with the name of the form mex_interface.c. In the previous example, the compiler would generate bar1_mex_interface.c and images_private_bar2_mex_interface.c.
NOTE: The above workaround does not work for compiled applications that make use of functions from the Image Processing Toolbox. Please reference the following solution if this is the case:
Solution 1-1A3JV: Why does my stand-alone application fail to find MEX-files from 'private' folders in the MATLAB toolboxes when deployed?

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!