MATLAB: Executables from Matlab compiler fail to run on the computer where they were built, but run on other computers. How to run executables created using the matlab compiler (mcc) in debug mode

built executable errorscompilerdebugexecutableMATLABMATLAB Compiler

I use the matlab compiler, via the Deploy Tool, to build an executable for Win-7 64-bit using Matlab 2012a, and MATLAB Compiler Version 4.17.
The executables run on other Win-7 64-bit computers that have either Matlab or the MCR installed, but the executables DO NOT RUN on the computer where they were built.
These executables immediately cause an error, prior to showing any output in the command console. When the executable is run on this laptop where the exe was built, the console window appears, but nothing happens in the console, and then causes an error dialog to appear that says “MYFUN.exe” has stopped working. Windows is collecting more information about the problem.” The system creates three files in the \Users\name\AppData\Local\Temp directory, but these appear noninformative to me.
Also, I have recently successfully built executables using Matlab R2010b for this same system (laptop with Win7-64) and they continue to run with no errors on this system now.
What I would like to do is to run the executable in debug mode. However I cannot figure out how to do this. Does anyone know?
Alternatively, if you have encountered this problem and solved it, I would be very appreciative to know how you solved it, and not bother with the debug mode execution.
Thank you very much. George

Best Answer

I have solved this problem by a new installation of Matlab. I installed R2012b and the compiled standalone program works on this computer.
I believe that reinstalling R2012a would also have solved this.
I think that the problem may have originated from trying to install the Win SDK and Visual C++ compilers for Win 7 after having R2012a installed. Also, I encountered complications with installing the Win SDK and Vis C++ compilers required for the Matlab compiler toolbox with R2012, since it no longer works with Vis C++ express versions. Perhaps the multiple attempts to get a good installation of the SDK and compilers broke a critical link with Matlab R2012a. What I had to do was detailed by a post on a microsoft support page: "In order to install the x64 compilers from the Windows 7 SDK after installing Visual Studio 2010 Service Pack 1, you'll need to install the Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1. The update is available from here: http://go.microsoft.com/fwlink/?LinkID=212355
When you install the Windows SDK, make sure to clear the "Visual C++ Compilers" checkbox, and install the SDK. Once the SDK is installed, install the compiler update to install the x64 compilers."
Perhaps doing the install of the SDK compilers as described prior to installing Matlab is key.
Related Question