MATLAB: A problem about MATLAB R2011b Builder EX on XP and Win 7

MATLAB Builder EX

I just tried the example of 'magic square'. I use microsoft visual studio 2010 as my compiler. I tested the example on my PC with XP and notebook with win 7. They happened the same problem (error code = 2). Please tell me how to fix it. Thanks.
The following is the error information.
LINK : fatal error LNK1181: cannot open input file 'Documents\MATLAB\xlmagic\src\xlmagic.def' D:\PROGRA~1\MATLAB\R2011B\BIN\MEX.PL: Error: Link of 'D:\MYDOCU~1\MATLAB\XLMAGIC\SRC\xlmagic_1_0.dll' failed. Error: An error occurred while shelling out to mbuild (error code = 2). Unable to build executable. Warning: mcc failed to create Excel Add-in "d:\My Documents\MATLAB\xlmagic\src\xlmagic.xla", you can manually create the Add-in by importing the .bas file into Excel.

Best Answer

This looks like a bug due to a space present in the path where you are compiling for. Note how it says "cannot open input file 'Documents\MATLAB\xlmagic\src\xlmagic.def'" - it omits the path before the space in "My Documents". Try copying your example to a directory without spaces and compile from there. Also, please consider reporting this to MathWorks Tech Support.