Problems with vensim compilation

Use this forum to post Vensim related questions.
Post Reply
Christian.Chaboud
Junior Member
Posts: 7
Joined: Wed May 04, 2011 11:52 am

Problems with vensim compilation

Post by Christian.Chaboud »

Dear Colleague and Vensim expert,

I try to compile a Vensim program using Microsoft Visual Studio 10.0
My operating system is Vensim7 (64 bites)

After asking for compiled vensim run I obtain the fllowing error message :
-------------------------
LINK : fatal error LNK1104 : impossible d'ouvrir le fichier 'LIBC.lib'
Errors while linking sim.dll - make sure complied simulations were propoerly installed .. .
-------------------------

Thanks for help

I use the following mdl.bat:
______________________________________
REM
REM The following should work with Microsoft C/C++ Version 7 (.net)
REM
REM if "%OS%" == "" set PATH="set PATH=c:\Program Files\Microsoft Visual Studio .NET\common7\ide";"c:\Program Files\Microsoft Visual Studio .NET\VC7\bin"
REM if "%OS%" == "Windows_NT" set PATH=c:\Program Files\Microsoft Visual Studio .NET\common7\ide;c:\Program Files\Microsoft Visual Studio .NET\VC7\bin
REM set LIB=c:\Program Files\Microsoft Visual Studio .NET\vc7\lib;c:\Program Files\Microsoft Visual Studio .NET\vc7\PlatformSDK\lib
REM set INCLUDE=c:\Program Files\Microsoft Visual Studio .NET\vc7\include;c:\Program Files\Microsoft Visual Studio .NET\vc7\PlatformSDK\Include
REM
REM The following should work with Microsoft C/C++ Version 6
REM
REM if "%OS%" == "" set PATH="c:\Program Fles\Microsoft Visual Studio\common\MSDev98\bin";"c:\Program Files\Microsoft Visual Studio\VC98\bin"
REM if "%OS%" == "Windows_NT" set PATH=c:\Program Files\Microsoft Visual Studio\common\MSDev98\bin;c:\Program Files\Microsoft Visual Studio\VC98\bin
REM set LIB=c:\Program Files\Microsoft Visual Studio\vc98\lib
REM set INCLUDE=c:\Program Files\Microsoft Visual Studio\vc98\include
REM
REM The following should work with Microsoft C/C++ Version 5
REM
REM if "%OS%" == "" set path="c:\Program Files\DevStudio\VC\bin";"c:\Program Files\DevStudio\SharedIDE\bin";
REM if "%OS%" == "Windows_NT" set path=c:\Program Files\DevStudio\VC\bin;c:\Program Files\DevStudio\SharedIDE\bin;
REM set LIB=c:\Program Files\DevStudio\VC\lib
REM set INCLUDE=c:\Program Files\DevStudio\VC\include
REM
REM The following should work with Microsoft C/C++ Version 4
REM
REM path=c:\msdev\bin
REM set LIB=c:\msdev\lib
REM set INCLUDE=c:\msdev\include
REM
REM The following lines actually do the work
REM
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
if exist mdl.obj del mdl.obj
if exist sim.dll del sim.dll
if exist simdll32.dll del simdll32.dll
if exist simdlx32.dll del simdlx32.dll
CL /O2 /c /DWIN32 mdl.c
if errorlevel 1 goto :error1
if not exist mdl.obj goto :error2
LINK /DLL /OUT:sim.dll /def:%1sim.def mdl.obj %1simext.obj %1vensim.lib
if errorlevel 1 goto :error3
if not exist sim.dll goto :error3
REM
REM The following line will create a simdll32.dll file for use with
REM the full Vensim DLL
REM LINK /DLL /OUT:simdll32.dll /def:%1sim.def mdl.obj %1simext.obj %1..\dll\vendll32.lib
REM if errorlevel 1 goto :error4
REM if not exist simdll32.dll goto :error4
REM
REM The following line will create a simdlx32.dll file for use with
REM the redistributable Vensim DLL
REM LINK /DLL /OUT:simdlx32.dll /def:%1sim.def mdl.obj %1simext.obj %1..\dll\vendlx32.lib
REM if errorlevel 1 goto :error5
REM if not exist simdlx32.dll goto :error4
REM
del sim.lib
del sim.exp
goto :exit
:error1
echo There were errors while compiling - check the paths in mdl.bat in vensim\comp
goto exit2
:error2
echo Unable to compile. You probably need to set paths in mdl.bat in vensim\comp
goto exit2
:error3
echo Errors while linking sim.dll - make sure compiled simulations were properly installed
goto :exit2
:error4
echo Errors linking for use with the full dll - check that ..\dll is the right directory
goto :exit2
:error5
echo Errors linkinf for use with the redistribution DLL - check that ..\dll is the right directory
goto :exit2
:exit2
pause
goto :exit3
:exit
echo ----------
echo Compilation of sim.dll seems to have been successful.
echo Close this window and continue.
:exit3
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: Problems with vensim compilation

Post by Administrator »

What version of Vensim are you using?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: Problems with vensim compilation

Post by Administrator »

You could also try changing
LINK /DLL /OUT:sim.dll /def:%1sim.def mdl.obj %1simext.obj %1vensim.lib
to
LINK /DLL /OUT:sim.dll /NODEFAULTLIB:libc.lib /def:%1sim.def mdl.obj %1simext.obj %1vensim.lib

I'm not sure it will work though. I've seen the error you specify before when using a MDL.BAT from an old version of Vensim.

Tony.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Christian.Chaboud
Junior Member
Posts: 7
Joined: Wed May 04, 2011 11:52 am

Re: Problems with vensim compilation

Post by Christian.Chaboud »

I'm using Vensim 5.4a released August 2004.
The porblem has benn fixed yesterday evening on my laptot with OS windows7 32 bites.
But I still have prmble with my destop wit OS Win7 64 bites.

Best Regards
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: Problems with vensim compilation

Post by Administrator »

Have you tried the modified link line I suggested?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Christian.Chaboud
Junior Member
Posts: 7
Joined: Wed May 04, 2011 11:52 am

Re: Problems with vensim compilation

Post by Christian.Chaboud »

I just used that modification

LINK /DLL /OUT:sim.dll /NODEFAULTLIB:libc.lib /def:%1sim.def mdl.obj %1simext.obj %1vensim.lib


It's OK now on my desktop !!

Thanks Very Much
Post Reply