gpt4 book ai didi

无法从 Matlab Coder 创建 .dll

转载 作者:行者123 更新时间:2023-11-30 15:17:59 24 4
gpt4 key购买 nike

我正在尝试使用 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 免费获取

关于无法从 Matlab Coder 创建 .dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31841205/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com