Why do I receive a LINK error when I use the MEX command in MATLAB 7.7 (R2008b)?

8 views (last 30 days)
I have a 64-bit machine and a 64-bit compiler (Microsoft Visual C++ 2008, Professional Edition). The command
mex -setup
locates the compiler and allows me to successfully select this compiler. However, when I execute an example such as:
mex yprime.c
I receive the following error:
LINK : fatal error LNK1104: cannot open file 'C:\DOCUME~1\WEBERJE\LOCAL'
C:\PROGRA~1\MATLAB\R2008B\BIN\MEX.PL: Error: Link of 'yprime.mexw64' failed.
!!!:
mex -v yprime.c
failed!

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 2 Oct 2013
In this particular case, the value of the environment variables TEMP and TMP on the user's machine was set to:
TEMP=C:\DOCUME~1\WEBERJE\LOCAL SETTINGS\TEMP
TMP=C:\DOCUME~1\WEBERJE\LOCAL SETTINGS\TEMP
There is a 'space' character between the words 'Local' and 'Settings' and thus the name 'Local Settings' was not returned in a shortened format by the machine to the compiler. So, the temporary directory where the linker was apparently looking for the required libraries was:
'C:\DOCUME~1\WEBERJE\LOCAL'
instead of:
'C:\DOCUME~1\WEBERJE\LOCAL SETTINGS'
This explains the error message that was generated when running the MEX command:
LINK : fatal error LNK1104: cannot open file 'C:\DOCUME~1\WEBERJE\LOCAL'
To workaround this issue, change the environment variables TEMP and TMP to some directory that does not contain spaces. For example, set the TEMP and TMP environment variables to:
C:\TEMP
NOTE: Ensure that such a directory exists and has write permissions for all users who are running the MEX command.

More Answers (0)

Categories

Find more on Manage Products in Help Center and File Exchange

Products


Release

R2008b

Community Treasure Hunt

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

Start Hunting!