Reputation: 415
I have a very annoying problem with Matlab. I have a custom C style DLL to talk to our hardware. It works fine on my PC and fine on my colleague's PC. On a third PC it fails to load with :
Error using ==> loadlibrary at 365 Failed to preprocess the input file. Output from preprocessor is:'cl' is not recognized as an internal or external command, operable program or batch file.
Obviously it can't find the compiler. Yet running !mex -setup gets my the intercative bit to select the only compiler on the machine (VS2008) and checking with !set vs shows the paths as correct. Trying to add paths directly doesn't seem to help either. As I very little idea about Matlab and an extensive trawl of the matlab forums and trying suggestions just doesn't help. Anybody any clues?
Upvotes: 4
Views: 1106
Reputation: 658
I don't do where you added the path directly, but try to add the path where cl.exe is into the:
My Computer -> Properties -> Advanced -> Environment Variables -> System Variables -> PATH
If you open a command prompt (Execute -> cmd.exe) and write "set PATH" (without the ") can you find the right path? What happens if you write cl.exe. Maybe you should execute vcvars32.bat from the right Visual Studio version (i.e. C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin )
Upvotes: 5
Reputation: 14467
Maybe a hack like creation of a cl.bat/cl.cmd file like
@rem CL.CMD
@rem vcvars32 or vcvars64 depending on the OS
@rem Explicitly set the variables for VC
call "<YourVCDir>\Bin\VCVARS32.BAT"
@rem Pass all the parameters to the "real" cl.exe
cl.exe %*
would help ?
Upvotes: 3