You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Errors related to Simulink containing Embedded Matlab Function
2 views (last 30 days)
Show older comments
Nitin Reddy Ganna
on 24 Feb 2012
I am using Matlab R2011a version 7.12.My platform is windows 7 and 64 bit.When i try to run the simulink model containing embedded function,I get the following error.
"Making simulation target "New_sfun", ...
C:\Users\nitin\Documents\MATLAB\slprj\_sfprj\New\_self\sfun\src>call "mexopts.bat" 'nmake' is not recognized as an internal or external command, operable program or batch file. "
I installed
1.Microsoft Visual studio 2010 SERVICE PACK
2.Microsoft Visual Express c++ 2010 express
3.Microsoft Software Development kit 7.1
4 .NET Framework 4.0
Please kindly help me with this.I searched a lot in the internet,but couldn't solve my problem.
Answers (1)
Kaustubha Govind
on 24 Feb 2012
You need to run the "mex -setup" command and select your installed compiler.
16 Comments
Nitin Reddy Ganna
on 24 Feb 2012
I tried the same earlier and selected Microsoft Visual Studio C++ 2010 Express as my compiler, but still couldn't solve my problem.
Kaustubha Govind
on 24 Feb 2012
Did the message from "mex -setup" says that the options file was updated successfully? Could you try deleting the "slprj" directory in the folder and try again.
Nitin Reddy Ganna
on 27 Feb 2012
After running "mex -setup" command here is what comes:
"Please verify your choices:
Compiler: Microsoft Visual C++ 2010 Express
Location: C:\Program Files (x86)\Microsoft Visual Studio 10.0
Are these correct [y]/n? y
***************************************************************************
Warning: MEX-files generated using Microsoft Visual C++ 2010 require
that Microsoft Visual Studio 2010 run-time libraries be
available on the computer they are run on.
If you plan to redistribute your MEX-files to other MATLAB
users, be sure that they have the run-time libraries.
***************************************************************************
Trying to update options file: C:\Users\nitin\AppData\Roaming\MathWorks\MATLAB\R2011a\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2011a\bin\win64\mexopts\msvc100freeopts.bat
Done . . .
**************************************************************************
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the new
API. You can find more information about this at:
http://www.mathworks.com/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9
Building with the -largeArrayDims option enables the new API.
************************************************************************** "
I have tried deleting the "slprj" directory,but still no use.
The same error appears.
Kaustubha Govind
on 27 Feb 2012
Do you have C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe present on your machine?
Nitin Reddy Ganna
on 28 Feb 2012
Yeah..
I tried to run the same simulink model in 32-bit operating system.It was running fine.
The compiler there was "lcc win-32".
Kaustubha Govind
on 28 Feb 2012
Okay - try this in a Windows (system) command prompt:
> call "C:\Users\nitin\AppData\Roaming\MathWorks\MATLAB\R2011a\mexopts.bat"
> nmake /?
What do you see?
Nitin Reddy Ganna
on 29 Feb 2012
"'nmake' is not recognized as an internal or external command,operable program or batch file."
Kaustubha Govind
on 29 Feb 2012
Open up C:\Users\nitin\AppData\Roaming\MathWorks\MATLAB\R2011a\mexopts.bat in an editor and see if "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" is being added to the system PATH variable correctly. Note that you might need to chase down values of variables such as VCINSTALLDIR that are created earlier in the same batch script.
Nitin Reddy Ganna
on 2 Mar 2012
It's still not working.I re-installed matlab and this time when i run the mex -setup i get different error:
"
*****************************************************************************
Error: Could not find the 64-bit compiler. This may indicate that the
"X64 Compilers and Tools" or the Microsoft Windows Software
Development Kit (SDK) is not installed. To build 64-bit MEX-files
Microsoft Visual C++ 2010 requires that these two packages are
installed properly.
*****************************************************************************
??? Error using ==> mex at 208
Unable to complete successfully."
Kaustubha Govind
on 2 Mar 2012
See footnote#3 here: http://www.mathworks.com/support/compilers/R2011a/win64.html - by default Visual Studio only installs compilers for 32-bit targets. Since you are using 64-bit MATLAB, you need to make sure that you install the x64 Compilers and Tools package with Visual Studio.
Nitin Reddy Ganna
on 2 Mar 2012
Here is the mexopts.bat file.I cross checked it with the batch file created where the model could be simulated.Both of them were same.Please notify the changes to be made if any.
"" @echo off
rem MSVC100FREEOPTS.BAT
rem
rem Compile and link options used for building MEX-files
rem using the Microsoft Visual C++ Express compiler version 10.0
rem
rem $Revision: 1.1.12.2 $ $Date: 2010/09/02 12:40:43 $
rem Copyright 2010 The MathWorks, Inc.
rem
rem StorageVersion: 1.0
rem C++keyFileName: MSVC100FREEOPTS.BAT
rem C++keyName: Microsoft Visual C++ 2010 Express
rem C++keyManufacturer: Microsoft
rem C++keyVersion: 10.0
rem C++keyLanguage: C++
rem
rem ********************************************************************
rem General parameters
rem ********************************************************************
set MATLAB=%MATLAB%
set VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 10.0
set VCINSTALLDIR=%VSINSTALLDIR%\VC
rem In this case, LINKERDIR is being used to specify the location of the SDK
set LINKERDIR=C:\Program Files\Microsoft SDKs\Windows\v7.1\
set PATH=%VSINSTALLDIR%\Common7\IDE;%VSINSTALLDIR%\Common7\Tools;%VCINSTALLDIR%\bin\amd64;%VCINSTALLDIR%\bin\VCPackages;%LINKERDIR%\Bin\NETFX 4.0 Tools\x64;%LINKERDIR%\Bin\x64;%LINKERDIR%\bin;%MATLAB_BIN%;%PATH%
set INCLUDE=%VCINSTALLDIR%\INCLUDE;%LINKERDIR%\include;%LINKERDIR%\include\gl;%INCLUDE%
set LIB=%VCINSTALLDIR%\LIB\amd64;%LINKERDIR%\lib\x64;%VCINSTALLDIR%\LIB;%MATLAB%\extern\lib\win64;%LIB%
set MW_TARGET_ARCH=win64
rem ********************************************************************
rem Compiler parameters
rem ********************************************************************
set COMPILER=cl
set COMPFLAGS=/c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD
set OPTIMFLAGS=/O2 /Oy- /DNDEBUG
set DEBUGFLAGS=/Z7
set NAME_OBJECT=/Fo
rem ********************************************************************
rem Linker parameters
rem ********************************************************************
set LIBLOC=%MATLAB%\extern\lib\win64\microsoft
set LINKER=link
set LINKFLAGS=/dll /export:%ENTRYPOINT% /LIBPATH:"%LIBLOC%" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /manifest /incremental:NO /implib:"%LIB_NAME%.x" /MAP:"%OUTDIR%%MEX_NAME%%MEX_EXT%.map"
set LINKOPTIMFLAGS=
set LINKDEBUGFLAGS=/debug /PDB:"%OUTDIR%%MEX_NAME%%MEX_EXT%.pdb"
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT=/out:"%OUTDIR%%MEX_NAME%%MEX_EXT%"
set RSP_FILE_INDICATOR=@
rem ********************************************************************
rem Resource compiler parameters
rem ********************************************************************
set RC_COMPILER=rc /fo "%OUTDIR%mexversion.res"
set RC_LINKER=
set POSTLINK_CMDS=del "%LIB_NAME%.x" "%LIB_NAME%.exp"
set POSTLINK_CMDS1=mt -outputresource:"%OUTDIR%%MEX_NAME%%MEX_EXT%;2" -manifest "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest"
set POSTLINK_CMDS2=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest"
set POSTLINK_CMDS3=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.map" ""
Kaustubha Govind
on 5 Mar 2012
You shouldn't need to change the mexopts.bat file - it looks like something is wrong with your compiler installation or System PATH variable. Did you install the x64 compilers as I suggested?
Nitin Reddy Ganna
on 8 Mar 2012
Yeah..
"Compiler: Microsoft Visual C++ 2010 Express
Location: C:\Program Files (x86)\Microsoft Visual Studio 10.0
Are these correct [y]/n? y
***************************************************************************
Warning: MEX-files generated using Microsoft Visual C++ 2010 require
that Microsoft Visual Studio 2010 run-time libraries be
available on the computer they are run on.
If you plan to redistribute your MEX-files to other MATLAB
users, be sure that they have the run-time libraries.
***************************************************************************
Trying to update options file: C:\Users\Nitin\AppData\Roaming\MathWorks\MATLAB\R2011a\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2011a\bin\win64\mexopts\msvc100freeopts.bat
Done . . .
**************************************************************************
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the new
API. You can find more information about this at:
http://www.mathworks.com/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9
Building with the -largeArrayDims option enables the new API.
************************************************************************** "
Kaustubha Govind
on 9 Mar 2012
Okay - it looks like this is going nowhere. I would recommend contacting Tech Support if you have a license that is on maintenance.
See Also
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)