我正在尝试使用VisualStudio2017作为Dymola2019中的编译器。我已经安装了VS2017 for C++中的所有组件(据我所能找到)。但是,当我尝试在Dymola中测试编译器时,我会得到如下错误消息:
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.
我也尝试过2015,但也失败了。
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.
我也无法在VS2017文件夹中的任何地方找到stdio.h。但它位于程序文件中的一个分隔文件夹WindowsSDK中。
编译器测试应该可以工作(至少从我过去使用dymola和VS的经验来看,不确定这些工具的新版本是否有问题)。
发布于 2019-07-16 07:17:17
为了完成这个任务,我还遇到了一个问题:我有管理权限,但是没有访问注册表的权限,所以Dymola抛出了编译器错误。有两种可能性:
下面是如何至少为VS2013更改路径的解决方案。首先,您需要在您作为管理员打开的文本编辑器中从vcvars32.bat
中打开%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\bin\
。在这里,您需要注释掉前3行,这些行执行设置多个路径的不可能的注册表调用。之后,您需要在vcvars32.bat
中手动设置这些路径。最后,vcvars32.bat
的开头应该如下所示:
:: @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\
也许,您需要为您的配置稍微调整一些路径。
要获得更多信息,您可以在这里查看:
VS2010 command prompt gives error: Cannot determine the location of the VS Common Tools folder
发布于 2019-05-02 08:30:36
您是如何验证已经安装了C++编译的所有程序的?
对于Visual的某些配置,您必须编译一个C/C++文件来触发实际编译器的下载(通常只安装IDE )。
(取决于管理员的版本和配置。)
发布于 2019-05-06 07:00:21
好的,结果是,即使我有管理权限,IT部门实际上并没有给我访问注册表的能力,即regedit,它只是被禁用了。
所以,在启用它之后,我可以确认Dymola现在对VS 2017和2015年都很好。
而且很明显,dymola需要访问regedit进行编译(不知道为什么)。
https://stackoverflow.com/questions/55922093
复制相似问题