Monday, January 14, 2013

MATLAB/Simulink & C Compiler Problems

Last weekend I thought I would try to run some of the models to make sure everything was working with my copy of MATLAB/Simulink (I am off campus and have the commercial version, R2012a).  I wanted to give those working with their own MATLAB/Simulink installations a heads up on problems I found.

When trying to run the model I received an error message from MATLAB about a C compiler not being found.  As instructed I ran the MATLAB  mex -setup command.  It did not find a compatible compiler even though I had the Visual C/C++ Express 2010 toolset installed.  It only wanted the Visual C/C++ Professional 2010 version or the version found in the Windows 7 Software Development Kit (SDK).

When I tried to install the Windows SDK the install kept failing.  It would find the Visual C/C++ Express 2010 compiler but it was a later build than the one in Windows SDK (4nnn versus 3mmm).  The Windows SDK said that it was not necessary to uninstall the later version of the compiler.

Liar.  I had to completely uninstall the Visual C/C++ Express 2010 kit before the Windows SDK would install.  I spent several hours of Web searching and debugging before getting the SDK to install.

Once the Windows SDK was installed the models from the class ran fine.

I have not tried to re-install the Visual C/C++ Express 2010 kit.  To me this a failure on Mathworks' part in that they do not recognize or cannot use a valid compiler.  It is also a failure on Microsoft's part in that the Windows SDK won't install with a later version of the compiler already installed.

I hope that my experience helps someone else avoid a frustrating, hair pulling experience trying to get the Simulink models to run.

3 comments:

  1. Bob,
    I can sympathize. I had to deal with similar problems last semester in the electric drive vehicles course.
    - KT

    ReplyDelete
  2. Hi Bob,

    This problem may only happen with a windows 64-bit system. My system is 32-bit and never face this problem. Last semester, I have the same problem in electric vehicles courses with my 64-bit system.

    ReplyDelete
  3. Bob,I faced up the same problem for my newest version of Matlab (2012). I try the 2010a version and found it is working.

    ReplyDelete

Note: Only a member of this blog may post a comment.