Error with RealTimeWorkshop Compiler

I am trying to generate the C code from simulink, but i am stuck with an error which is stopping the generation of C code. The error is :
Error using ==> issue_inv_comp_env_val_error at 9
"Invalid setting for environment variable MSDevDir or DevEnvDir. The setting is: '' You can verify the setting by checking for the existence of: %DevEnvDir%\..\tools\vsvars32.bat (for Visual C/C++ 9.0) %MSDevDir%\..\..\vc98\bin\vcvars32.bat (for Visual C/C++ 6.0) %DevEnvDir%\..\tools\vsvars32.bat (for Visual C/C++ 8.0)
You must define MSDevDir or DevEnvDir to be: set %DevEnvDir%=<VisualRoot>\common7\ide (for Visual C/C++ 9.0) set %MSDevDir%=<VisualRoot>\common\msdev98 (for Visual C/C++ 6.0) set %DevEnvDir%=<VisualRoot>\common7\ide (for Visual C/C++ 8.0)
This error may be due to an invalid preference file: C:\Dokumente und Einstellungen\FGLuser\Anwendungsdaten\MathWorks\MATLAB\R2010b\mexopts.bat Please run "mex -setup" at the MATLAB prompt to correct"
I tried creating the mex -setup at matlab prompt but could not solve my problem... I am not understading why this problem exists... Can any one help me in solving this. Thanks in advance for reply..

7 Commenti

Friedrich
Friedrich il 17 Ago 2012
Modificato: Friedrich il 17 Ago 2012
When running mex -setup, which compiler did you chose?
I have choosen the Lcc-win32 C 2.4.1 compiler
Seems like you are using 10b on Windows XP. Can you post the content of your mexopts.bat (C:\Dokumente und Einstellungen\FGLuser\Anwendungsdaten\MathWorks\MATLAB\R2010b\mexopts.bat) file here?
Do you use the Labview Simulation Interface Toolkit together with your Simulink intallation?
I am using 2007b on Windows XP. Content of mexopts.bat file is @echo off rem LCCOPTS.BAT rem rem Compile and link options used for building MEX-files rem using the LCC compiler version 2.4 rem rem $Revision: 1.14.4.3 $ $Date: 2006/06/23 19:04:43 $ rem rem ****************************************************************** rem General parameters rem ******************************************************************
set MATLAB=%MATLAB% set PATH=%MATLAB%\sys\lcc\bin;%PATH%
rem ****************************************************************** rem Compiler parameters rem ****************************************************************** set COMPILER=lcc set COMPFLAGS=-c -Zp8 -I"%MATLAB%\sys\lcc\include" -DMATLAB_MEX_FILE -noregistrylookup set OPTIMFLAGS=-DNDEBUG set DEBUGFLAGS=-g4 set NAME_OBJECT=-Fo set MW_TARGET_ARCH=win32
rem ****************************************************************** rem Library creation command rem ****************************************************************** set PRELINK_CMDS1=lcc %COMPFLAGS% "%MATLAB%\sys\lcc\mex\lccstub.c" -Fo%LIB_NAME%2.obj
rem ****************************************************************** rem Linker parameters rem ****************************************************************** set LIBLOC=%MATLAB%\extern\lib\win32\lcc set LINKER=lcclnk set LINKFLAGS= -tmpdir "%OUTDIR%." -dll "%MATLAB%\extern\lib\win32\lcc\%ENTRYPOINT%.def" -L"%MATLAB%\sys\lcc\lib" -libpath "%LIBLOC%" %LIB_NAME%2.obj set LINKFLAGSPOST=libmx.lib libmex.lib libmat.lib set LINKOPTIMFLAGS=-s set LINKDEBUGFLAGS= set LINK_FILE= set LINK_LIB= set NAME_OUTPUT=-o "%OUTDIR%%MEX_NAME%%MEX_EXT%" set RSP_FILE_INDICATOR=@
rem ****************************************************************** rem Resource compiler parameters rem ****************************************************************** set RC_COMPILER=lrc -I"%MATLAB%\sys\lcc\include" -noregistrylookup -fo"%OUTDIR%mexversion.res" set RC_LINKER=
set POSTLINK_CMDS1=del %LIB_NAME%2.obj set POSTLINK_CMDS2=del "%OUTDIR%%MEX_NAME%.exp" set POSTLINK_CMDS3=del "%OUTDIR%%MEX_NAME%.lib" I am not using any Labview Simulation Interface Toolkit
Interesting. Looking at the MATLAB Output in the error, it seems like MATLAB picks up the preference folder of R2010b. Do you have 10b installed?
Do you have any environment variable called MATLAB_Prefdir? If so, which value does it have? (In Matlab you can run "!set" (without the ") and post the output here)
I don't have R2010b installed... I only have R2007b... I don't have any environment variable called MATLAB_Prefdir.
Can anyone let me know if there is any solution for this. Thanks in advance.

Accedi per commentare.

Risposte (1)

Sachin Ganjare
Sachin Ganjare il 12 Set 2012

0 voti

You will need to verify mexopts.bat file manually to check whether correct paths are enetered by running 'mex -setup' command

Categorie

Richiesto:

il 17 Ago 2012

Community Treasure Hunt

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

Start Hunting!

Translated by