2

I am trying to use Visual Studio 2017 as a compiler in Dymola 2019. I have installed all the components in VS2017 for C++ (as far as i could find). But when i try to test compiler in Dymola, I get an error message as follows :

Compiling and linking the model (Visual C++). 

**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.11
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'
"Testing 32-bit compilation" 
dsmodel.c
dsmodel.c(1): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory

Error generating Dymosim. 

I also tried with Visual Studio 2015, but it failed as well.

Compiling and linking the model (Visual C++). 

ERROR: Cannot determine the location of the VS Common Tools folder.
"Testing 32-bit compilation" 
'cl' is not recognized as an internal or external command,
operable program or batch file.

Error generating Dymosim.

I also couldnt find stdio.h in the VS2017 folder anywhere. But its located in a separeate folder WindowsSDK in program files.

The compiler test should work (at least from my past experience with dymola and VS, not sure if something got messed up with the newer versions of these tools)

nikbarve
  • 33
  • 7

4 Answers4

1

How have you verified that you have installed everything for C++-compilation?

For some configurations of Visual Studio you have to compile a C/C++ file to trigger download of the actual compiler (only the IDE is installed normally).

(Depending on version and configuration by administrators.)

Hans Olsson
  • 11,123
  • 15
  • 38
  • I do have admin rights myself, so its easy for me to make changes to VS installation. I triggered the C++ installation by creating a new project. And, I actually went through the entire list and installed everything that I could find in VS that was related to C++ compilation in any way. – nikbarve May 03 '19 at 09:06
  • Just to be clear: after creating the project you also compiled it? If so it seems you have to contact your normal support channel. – Hans Olsson May 03 '19 at 11:50
  • 1
    Yes, compilation worked properly in VS. Turns out I didnt have access to regedit even though I was admin. and that was the problem. I got it enabled from the IT service and now dymola works. – nikbarve May 06 '19 at 07:01
1

Ok, so turns out, even though I had admin rights, the IT dept didnt actually give me the ability to access registry i.e. regedit and it was just disabled.

So, after getting it enabled, I can confirm that now Dymola works fine with VS 2017 as well as 2015.

And apparently dymola needs to access regedit for compiling (not sure why).

nikbarve
  • 33
  • 7
1

Just to complete this as I also had the problem that I had the admin rights, but no access to the registry, so that Dymola threw the compiler error. There are 2 possibilities:

  1. Get access to the registry from the IT.
  2. If this is not possible, due to ristrictions. Eiter install a tool that bypass the registry or change the paths manually, which I would recommand, as the tools are not so serious.

Here is the solution how to change the paths at least for VS2013. First of all, you need to open the vcvars32.bat from %ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\bin\ in a texteditor that you have opened as admin. There you need to comment out the first 3 lines, which perform the not possible registry call that sets several paths. Afterwards, you need to set those paths manually in the vcvars32.bat. Finally, the beginning of the vcvars32.bat should look like this:

    :: @call :GetVSCommonToolsDir
    :: @if "%VS120COMNTOOLS%"=="" goto error_no_VS120COMNTOOLSDIR

    :: @call "%VS120COMNTOOLS%VCVarsQueryRegistry.bat" 32bit No64bit

    @SET VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\
    @SET VCINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\
    @SET FrameworkDir32=c:\Windows\Microsoft.NET\Framework\
    @SET FrameworkVersion32=v4.0.30319
    @SET Framework40Version=v4.0
    @SET WindowsSdkDir=%ProgramFiles(x86)%\Windows Kits\8.1\
    @SET ExtensionSdkDir=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v8.1\ExtensionsSDKs\
    @SET WindowsSDK_ExecutablePath_x86=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\
    @SET WindowsSDK_ExecutablePath_x64=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\

Perhaps, you need to slightly adapt some paths for your configuration.

For more information you can look here:

VS2010 command prompt gives error: Cannot determine the location of the VS Common Tools folder

LaurinO
  • 136
  • 6
0

Different reasons may cause it.

You might catch up with the issue if you deleted the PATH value in the system environment variables by accident before installing Dymola. After adding "%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0" into the PATH value in the system environment variables, the compiler can work again.