Compiling model

Use this forum to post Vensim related questions.
Post Reply
Wilson
Administrator
Posts: 51
Joined: Thu Mar 06, 2003 5:05 am

Compiling model

Post by Wilson »

I'm trying to compile a model from Vensim 5.9. The compiler I'm using is Visual C# Express 2008 Edition.

After editing MDL.BAT to reset the path statements etc to c:\program files\Microsoft Visual Studio 9.0\....

and recompiling the Simext.c ,when i get to the step to compile the actual model I get many error messages, such as:

syntax error identifier 'comp_rate'
syntax error identifier 'init_time'

etc

Guess I've missed out definitions or linking somewhere along the route (I'm totally clueless when it comes to programming) . Anybody had anything similar or can point me to where I may have gone wrong ?
Administrator
Super Administrator
Posts: 4838
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

Try editing the mdl.bat file and adding the following line right at the top of the file.

call "C:\Program Files\Microsoft Visual Studio 9\VC\bin\vcvars32.bat"

Just make sure the path to vcvars32.bat is correct.

Also check in Vensim that it is calling the correct MDL.BAT (Tools->Options->Startup, compiled simulation path).

Tony.
Wilson
Administrator
Posts: 51
Joined: Thu Mar 06, 2003 5:05 am

Post by Wilson »

Thanks Tony, tried that but still no joy.

The VCVars command files runs ok, Simext.c compiles okay, and the startup path is correct.

The first line it falls over on in mdl.c is:

void VEFCC comp_rate(void)
{
mdl_func0();
}

With my minute amount of C programming knowledge, could it be anything to do with the version of simext.c I'm using, as I notice this has the line

void PASCAL ccomp_rate() {comp_rate() ;}

if squiggly brackets means comment out

Maybe I'm using the wrong simext.c ?
Administrator
Super Administrator
Posts: 4838
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

I had the same problem recently, the compiled simulation path was pointing to an old version of Vensim (I had 5.7 and 5.9 installed at the same time).

As soon as I made the changes to mdl.bat and pointed Vensim to the correct path, it all ran fine. I did not need to re-compile anything.

Tony.
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

Note that the file simext.c is no longer compiled separately, rather it is simply included in mdl.c. Generally you should not have to do much beyond change the path statements in mdl.bat after it is installed. It is probably better to reinstall compiled simulation support and edit mdl.bat than to try to adapt an existing comp directory. vcvars32 sometimes works, but sometimes overruns the environmental memory buffers and leaves you with partial paths to things - though that may be an old memory (win NT/2K and not XP/Vista).
Post Reply