无法从 Matlab Coder 创建 .dll

Can't create a .dll from Matlab Coder

我正在尝试使用 Matlab Coder 工具将一些 matlab 代码转换为 c 动态库 (.dll)。我在一些简单的示例代码上尝试它,但我不断收到同样的错误,我找不到解决方案。

我的代码是:

function y = lbryTest(x, z) %#codegen
%QUICKTEST Summary of this function goes here
%   Detailed explanation goes here
y = 1.0;
a = x + z;
b = x * a;
y = b/3 + y;
end

我已经尝试使用应用程序版本的编码器以及命令:codegen -config:dll lbryTest -args {2.0, 5.0} 构建日志(包括错误)是:

1   C:/PROGRA~1/MATLAB/R2015a/sys/lcc64/lcc64/bin/lcc64 -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2015a/sys/lcc64/lcc64/include64 -DMODEL=lbryTest -DHAVESTDIO -DUSE_RTMODEL -IC:/Users/shutchinson/Documents/MATLAB -IC:/Users/shutchinson/Documents/MATLAB/codegen/dll/lbryTest -IC:/PROGRA~1/MATLAB/R2015a/extern/include -IC:/PROGRA~1/MATLAB/R2015a/simulink/include -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/ert -Fo"lbryTest_initialize.obj" "lbryTest_initialize.c"
2   C:/PROGRA~1/MATLAB/R2015a/sys/lcc64/lcc64/bin/lcc64 -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2015a/sys/lcc64/lcc64/include64 -DMODEL=lbryTest -DHAVESTDIO -DUSE_RTMODEL -IC:/Users/shutchinson/Documents/MATLAB -IC:/Users/shutchinson/Documents/MATLAB/codegen/dll/lbryTest -IC:/PROGRA~1/MATLAB/R2015a/extern/include -IC:/PROGRA~1/MATLAB/R2015a/simulink/include -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/ert -Fo"lbryTest_terminate.obj" "lbryTest_terminate.c"
3   C:/PROGRA~1/MATLAB/R2015a/sys/lcc64/lcc64/bin/lcc64 -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2015a/sys/lcc64/lcc64/include64 -DMODEL=lbryTest -DHAVESTDIO -DUSE_RTMODEL -IC:/Users/shutchinson/Documents/MATLAB -IC:/Users/shutchinson/Documents/MATLAB/codegen/dll/lbryTest -IC:/PROGRA~1/MATLAB/R2015a/extern/include -IC:/PROGRA~1/MATLAB/R2015a/simulink/include -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/ert -Fo"lbryTest.obj" "lbryTest.c"
4   C:/PROGRA~1/MATLAB/R2015a/sys/lcc64/lcc64/bin/lcc64 -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2015a/sys/lcc64/lcc64/include64 -DMODEL=lbryTest -DHAVESTDIO -DUSE_RTMODEL -IC:/Users/shutchinson/Documents/MATLAB -IC:/Users/shutchinson/Documents/MATLAB/codegen/dll/lbryTest -IC:/PROGRA~1/MATLAB/R2015a/extern/include -IC:/PROGRA~1/MATLAB/R2015a/simulink/include -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/ert -Fo"rt_nonfinite.obj" "rt_nonfinite.c"
5   C:/PROGRA~1/MATLAB/R2015a/sys/lcc64/lcc64/bin/lcc64 -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2015a/sys/lcc64/lcc64/include64 -DMODEL=lbryTest -DHAVESTDIO -DUSE_RTMODEL -IC:/Users/shutchinson/Documents/MATLAB -IC:/Users/shutchinson/Documents/MATLAB/codegen/dll/lbryTest -IC:/PROGRA~1/MATLAB/R2015a/extern/include -IC:/PROGRA~1/MATLAB/R2015a/simulink/include -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/ert -Fo"rtGetNaN.obj" "rtGetNaN.c"
6   C:/PROGRA~1/MATLAB/R2015a/sys/lcc64/lcc64/bin/lcc64 -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2015a/sys/lcc64/lcc64/include64 -DMODEL=lbryTest -DHAVESTDIO -DUSE_RTMODEL -IC:/Users/shutchinson/Documents/MATLAB -IC:/Users/shutchinson/Documents/MATLAB/codegen/dll/lbryTest -IC:/PROGRA~1/MATLAB/R2015a/extern/include -IC:/PROGRA~1/MATLAB/R2015a/simulink/include -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2015a/rtw/c/ert -Fo"rtGetInf.obj" "rtGetInf.c"
7   C:/PROGRA~1/MATLAB/R2015a/sys/perl/win32/bin/perl.exe C:/PROGRA~1/MATLAB/R2015a/rtw/c/tools/mkvc_lnk.pl lbryTest.lnk lbryTest_initialize.obj lbryTest_terminate.obj lbryTest.obj rt_nonfinite.obj rtGetNaN.obj rtGetInf.obj lccstub.obj
8   "### Creating dynamic library "./lbryTest.dll" ..."
9   C:/PROGRA~1/MATLAB/R2015a/sys/lcc64/lcc64/bin/lcclnk64 -dll -entry LibMain -s -LC:/PROGRA~1/MATLAB/R2015a/sys/lcc64/lcc64/lib64  lbryTest.def -o ./lbryTest.dll @lbryTest.lnk  
10   cannot open lccstub.obj
11   gmake: *** [lbryTest.dll] Error 1
12   The make command returned an error of 2
13   'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
14   operable program or batch file.
15   
16   Error(s) encountered while building model "lbryTest":
17   ### Failed to generate all binary outputs.

我可以从这段代码创建一个 .lib,但我需要一个 .dll,这被证明是困难的。看起来我缺少一些目标文件或 matlab 找不到它,但我不知道该怎么办。

此建议归功于 Ryan Livingston,我正在将其转化为官方答复

文件 lccstub.c(编译为 lccstub.obj)不在您的机器上,而它应该在您的机器上。要修复它,您应该为 Matlab 安装支持的编译器。

Windows SDK 7.1 可从 here

免费获得