Compilation does not work

Use this forum to post Vensim related questions.
Post Reply
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Compilation does not work

Post by LAUJJL »

Hi

My computer crushed and I had to reinstall Windows 10 and all my applications;

i downloaded the latest DSS version and installed it. i installed too a new version of the 21019 C++ compiler (Visual studio 2019).

When i ask to compile it tells me that the compilation failed and that i have to check the path in the mdl.bat?

In fact it is the error 1 in the MDLDP64.bat command file;

It says that the 'CL' command is not a recognized internal or external command.

Compiling Vensim model ...
Setting paths for Vensim compilation using Microsoft compilers
Visual Studio 2019
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.11.21
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
Creating optimized DLL
'CL' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
Unable to compile - failed to set paths. Check the paths in mdldp.bat in vensim\comp
Appuyez sur une touche pour continuer...

The command that seems not to work is

echo Creating optimized DLL
CL /O2 /c /I "%2" /DDBLPREC /DWIN32 /DWIN64 /Dx64 /D_x64 /D_WIN32 /D_WIN64 mdl.c

After that it jumps to the error 1 line;

The mdl.c file exists and is in the same directory than the vensim model.

i have checked that the compiler files are in the right directories;

What is happening?

Best regards;

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

Re: Compilation does not work

Post by Administrator »

Can you paste the complete contents of MDLDP64.bat here?

Near the start of the file, attempts are made to detect the compiler. If it cannot be detected, it will fail.
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
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Compilation does not work

Post by LAUJJL »

I cannot past the entire mdlde64. It sayt Error 446.
i sent it to vensim@vensim.com
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Compilation does not work

Post by tomfid »

My guess is that your visual studio installation has a nonstandard location. In that case this line will fail:
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64
Then subsequent calls to tools like CL will fail.

You can check that path and modify if necessary.

If you turn "@ECHO ON" at the start of the .bat, and add a PAUSE at the end, it's easier to see what's going on.
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Compilation does not work

Post by LAUJJL »

Hi Tom

Thank you for your reply.

I put the echo on in the batch file and this is the answer.

Compiling Vensim model ...

C:\nouveau rent\Simple_135>REM Comment out the ECHO statement if you need more information for debugging paths.

C:\nouveau rent\Simple_135>REM

C:\nouveau rent\Simple_135>REM First set paths

C:\nouveau rent\Simple_135>echo Setting paths for Vensim compilation using Microsoft compilers
Setting paths for Vensim compilation using Microsoft compilers

C:\nouveau rent\Simple_135>REM

C:\nouveau rent\Simple_135>REM These paths match the typical installations of Microsoft compilers.

C:\nouveau rent\Simple_135>REM You may need to adjust the paths here to suit the configuration of your system.

C:\nouveau rent\Simple_135>REM Note that if you are using a 64 bit version of windows the "Program Files"

C:\nouveau rent\Simple_135>REM directory will be "Program Files (x86)" - the program files directory may also

C:\nouveau rent\Simple_135>REM have a different name or be on a different drive (and the C compiler might have

C:\nouveau rent\Simple_135>REM been installed elsewhere).

C:\nouveau rent\Simple_135>REM The following should work with Microsoft C/C++ Version 2019

C:\nouveau rent\Simple_135>REM

C:\nouveau rent\Simple_135>REM Note : You must ensure that you have the correct compile tools installed.

C:\nouveau rent\Simple_135>REM During installation, select "Desktop development with C++" and tick all boxes.

C:\nouveau rent\Simple_135>REM

C:\nouveau rent\Simple_135>if exist "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" (
echo Visual Studio 2019
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64
goto comp
)
Visual Studio 2019
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.11.21
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
Creating optimized DLL
'CL' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
Unable to compile - failed to set paths. Check the paths in mdldp.bat in vensim\comp
Appuyez sur une touche pour continuer...

If the call"C:\Program files ... fails is there any warning?

i already checked the paths of the compiler paths; i did not finc any difference.
i will check it again.

What seems strange is that the directory c:\nouveau rent\Simple_135 is where the .mdl file is.

the mdldp64 is supposed to be in the common directory.


Regards.

JJ
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Compilation does not work

Post by LAUJJL »

I suppose that the directory is where the messages are sent to.
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Compilation does not work

Post by LAUJJL »

Hi

I have verified again the paths asked in the batch file. Evenrything is OK and the VsDevCmd.bat file exists.
the only thing that I cannot verify is the '-arch=amd64' at the end of the call. i do not know what it means.

Regards.
JJ
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Compilation does not work

Post by tomfid »

LAUJJL wrote: Fri Nov 25, 2022 4:46 pm
C:\nouveau rent\Simple_135>if exist "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" (
echo Visual Studio 2019
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64
goto comp
)
Visual Studio 2019
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.11.21
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
This seems to indicate that the MS path-setting has worked.
Creating optimized DLL
'CL' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
Unable to compile - failed to set paths. Check the paths in mdldp.bat in vensim\comp
Appuyez sur une touche pour continuer...
However, the failure to find CL suggests that the Microsoft .bat has somehow failed silently.
If the call"C:\Program files ... fails is there any warning?
Apparently not, but I think there's a way to turn on some diagnostics. I'll see if I can find that.
What seems strange is that the directory c:\nouveau rent\Simple_135 is where the .mdl file is.

the mdldp64 is supposed to be in the common directory.
The path points to \simple because the generated mdl.c to be compiled is in the same directory as the model.
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Compilation does not work

Post by LAUJJL »

Hi

After the compilation fails, Vensim says 'failed to compile the model (does not exist)'.

the other warnings are in the echos of the command file I joined.
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Compilation does not work

Post by tomfid »

The key symptom is:
'CL' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
This means that, even though vcDevCmd.bat has run, the compiler environment is not set up correctly - specifically, CL.exe can't be found.
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Compilation does not work

Post by LAUJJL »

Hi

I have found the CL.exe file in 4 directories listed below.

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x86

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx86\x64

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx86\x86

I have agian tried tried to compile, but the modification date of the 4 files has nkot been changed.

Regards.

JJ
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Compilation does not work

Post by tomfid »

Did you include the "Desktop Development with C++" module when you installed Visual Studio?
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Compilation does not work

Post by LAUJJL »

I think so. But I will reinstall visual studio.
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Compilation does not work

Post by tomfid »

In the Apps section of Settings, there's a "Modify" option for the installation that may save time. (I think re-running the installer does the same thing.)
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Compilation does not work

Post by LAUJJL »

Question?

What current version of the visual studio to you use? there are moany of them?

I have gonne to the man who reinstalled windows 10 and he tried to install the compiler. Hefound that the CL.exe was not recognized because it was not recognized as an environmetnal variable; He then decalred the CL.exe as an environmental variable that is in the c:\user\bureau\document\visual\VC\\bin. After that I tried again the compiler and the CL was now recognized but there was a new error. But we did not try another CL.exe from the three other places. Where is situated the CL.exe used by Vensim?

Joined the error from the command file.

Regards.

JJ
Attachments
Capture.PNG
Capture.PNG (155.44 KiB) Viewed 3843 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Compilation does not work

Post by tomfid »

Setting the environment path for CL.exe probably won't work, because a lot of other resources are needed. Possibly that's why stdio.h isn't found.

The purpose of calling Microsoft's VsDevCmd.bat is to set up the environment for command line use of the compiler tools. No manual environment settings should be needed.

The mystery here is why subsequent calls to CL fail. It seems like VsDevCmd is failing to set up a working environment, but the failure is silent, so we can't diagnose it.
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Compilation does not work

Post by LAUJJL »

Hi

i have erased the manual modifications of the environment variables.

How can I help.
I can go to the PC specialist who installed windows ans sold my computer for help. He is very keen and builds customized computers.

Regards.

JJ
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Compilation does not work

Post by LAUJJL »

I reinstalled visual studio 2019. I did not find any question about the desktop after having unistalled the previous one. i did the same for Vensim that I uninstalled and installed again with a previous downloaded *.exe. i could not download anything from Vensim that toldk that i had alarady downloaded too many downloads. I still does not work. i will try with a previous visualtudio version for instance the 2015 one.

What else can I do?

Regards;

JJ
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Compilation does not work

Post by LAUJJL »

I have tried to download the 2017 version but i could not find it in the microsoft web site.
From where do you download the C++ 2019 compiler? It can be downloaded from different sources: from microsoft or elsewhere. I tried to download from microsoft where I am registered. Which version exactly you download and from where?

Regards.

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

Re: Compilation does not work

Post by Administrator »

You can download from here
https://visualstudio.microsoft.com/vs/community/

When installing, make sure you tick the box for C/C++. This is all you need.
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
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Compilation does not work

Post by LAUJJL »

Hi

Thank you for your answer.

I downloaded from your source and dwonloaded visual studio 2022, finding no 2019 version. Of course there are no files from the directories specified in the mdl;bat and of course it does not compile. When installing it did not ask me anything about c++ and no ticking was necessary.
Regards.
JJ
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: Compilation does not work

Post by Administrator »

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
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Compilation does not work

Post by LAUJJL »

Hi

I have found the 2019 version and now it works.

Thank you for your help.

JJ
Post Reply