无法从Matlab Coder创建.dll

时间:2015-08-05 19:28:05

标签: c matlab dll 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找不到它,但我不知道该怎么做。

1 个答案:

答案 0 :(得分:1)

向Ryan Livingston表示赞同这一建议,我将其转变为正式答案

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

Windows SDK 7.1可从here

免费获得