Pregunta

While I am trying to run a simulink model the following error is encountered in relation with compilation and linking of C/C++ code

C:\Comms\slprj\_sfprj\quantizer_sim\_self\sfun\src>call "mexopts.bat"  

Microsoft (R) Program Maintenance Utility Version 10.00.30319.01 
Copyright (C) Microsoft Corporation.  All rights reserved. 

### Compiling "quantizer_sim_sfun.c" 
    cl.exe /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD   /I "C:\Program Files\MATLAB\R2012b\extern\include" /I "C:\Program Files\MATLAB\R2012b\simulink\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\mex\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\debugger\include"  "quantizer_sim_sfun.c" 
quantizer_sim_sfun.c 
### Compiling "quantizer_sim_sfun_registry.c" 
    cl.exe /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD   /I "C:\Program Files\MATLAB\R2012b\extern\include" /I "C:\Program Files\MATLAB\R2012b\simulink\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\mex\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\debugger\include"  "quantizer_sim_sfun_registry.c" 
quantizer_sim_sfun_registry.c 
### Compiling "c1_quantizer_sim.c" 
    cl.exe /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD   /I "C:\Program Files\MATLAB\R2012b\extern\include" /I "C:\Program Files\MATLAB\R2012b\simulink\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\mex\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\debugger\include"  "c1_quantizer_sim.c" 
c1_quantizer_sim.c 
### Compiling "c2_quantizer_sim.c" 
    cl.exe /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD   /I "C:\Program Files\MATLAB\R2012b\extern\include" /I "C:\Program Files\MATLAB\R2012b\simulink\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\mex\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\debugger\include"  "c2_quantizer_sim.c" 
c2_quantizer_sim.c 
### Linking ... 
    link.exe /nologo /dll /OPT:NOREF /export:mexFunction  /OUT:quantizer_sim_sfun.mexw64 /map:"quantizer_sim_sfun.map"  "C:\Program Files\MATLAB\R2012b\stateflow\c\mex\lib\win64\sfc_mex.lib" "C:\Program Files\MATLAB\R2012b\stateflow\c\debugger\lib\win64\sfc_debug.lib"  "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libmx.lib" "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libmex.lib" "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libmat.lib" "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libfixedpoint.lib" "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libut.lib" "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libmwmathutil.lib" "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libemlrt.lib" "C:\Program Files\MATLAB\R2012b\lib\win64\libippmwipt.lib"   "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libmwblascompat32.lib" @quantizer_sim_sfun.mol 
LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib' 
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe"' : return code '0x450' 
Stop. 



Error using quantizer_script (line 24)
Error using targetman>throw_make_error (line 588)
(SLSF Diagnostic)

Currently Matlab is configured with Visual Studio 2010 Compiler. In Addition I checked that the LIBPATH is correctly set from Matlab. I am also running Matlab with administator's permissions.

How can the LINK and NMAKE errors be solved?

¿Fue útil?

Solución

Visual Studio Express editions are no longer supported.

When you run mex -setup choose the SDK 7.1 (download here, select x64 compilers during installation).

Also be sure you install the .NET Framework 4.0 runtime.

Big however: With the SDK, there is a bug, where compilers get removed (details from MS)! Check it out here too. The patch is on Microsoft's website.

See this support article for tips on how to download and configure the SDK for MATLAB. Maybe confirm that the compilers were selected in the installation.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top