Visual studio 2015 链接:致命错误LNK1104:无法打开文件';ucrt.lib'; 目前我正在构建Simulink实时模型,并将微软Visual C++编译器社区2015作为SIMULINK实时编译器。当我尝试构建模型时,会出现以下错误: ### Linking ... link.exe /nologo /dll /MANIFEST /OPT:NOREF /export:mexFunction /OUT:Test_Handler_sfun.mexw64 /map:"Test_Handler_sfun.map" @Test_Handler_sfun.mol LINK : fatal error LNK1104: cannot open file 'ucrt.lib' NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\Bin\amd64\link.exe"' : return code '0x450' Stop.

Visual studio 2015 链接:致命错误LNK1104:无法打开文件';ucrt.lib'; 目前我正在构建Simulink实时模型,并将微软Visual C++编译器社区2015作为SIMULINK实时编译器。当我尝试构建模型时,会出现以下错误: ### Linking ... link.exe /nologo /dll /MANIFEST /OPT:NOREF /export:mexFunction /OUT:Test_Handler_sfun.mexw64 /map:"Test_Handler_sfun.map" @Test_Handler_sfun.mol LINK : fatal error LNK1104: cannot open file 'ucrt.lib' NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\Bin\amd64\link.exe"' : return code '0x450' Stop.,visual-studio-2015,sdk,windows-10,simulink,matlab-compiler,Visual Studio 2015,Sdk,Windows 10,Simulink,Matlab Compiler,以前我也有过这个错误,我相信也是由同样的问题引起的。我以一种非常不公正的方式解决了这个问题 C1083: Cannot open include file: 'stddef.h': No such file or directory 我在谷歌上搜索了不少。我发现这是因为某些文件和/或库现在位于Windows 10 SDK安装文件夹(C:\Program files(x86)\Windows Kits\10)中,并且编译器中不知何故没有包含此路径。当您在VisualStudio项目中工作时,

以前我也有过这个错误,我相信也是由同样的问题引起的。我以一种非常不公正的方式解决了这个问题

 C1083: Cannot open include file: 'stddef.h': No such file or directory 
我在谷歌上搜索了不少。我发现这是因为某些文件和/或库现在位于Windows 10 SDK安装文件夹(C:\Program files(x86)\Windows Kits\10)中,并且编译器中不知何故没有包含此路径。当您在VisualStudio项目中工作时,有很多解决方案,但在使用Matlab和/或Simulink时则没有


如何确保编译器可以找到并打开库和文件?

既然您在“不合法的问题”中解决了丢失的头文件,我将为您当前的问题提出另一个不合法的解决方案。我也遇到了同样的问题,将相应的库路径(
-L..
添加到编译选项有助于:

mex -output mybinary 
    -I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt"
    -L"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64"

请确保将其调整到您的Windows工具包的确切版本(
10.0.10240.0)和目标(
x64
)。

我的答案更适合Windows 8.1和VS2017。 为我使用Visual Studio安装程序(在所有程序中)和通过添加Windows 8.1 SDK和UCRT SDK来修改C++的桌面开发。 参考截图: