MCC编译器"内部错误:无法确定方法类"

时间:2014-07-03 19:18:59

标签: matlab mcc

我有Matlab脚本,我试图编译为可执行文件,它将作为大批量进程的一部分在无头服务器上运行。该脚本在十多年的时间里调用了几个非程序员(科学家)编写的函数和类,我很难将其编译。

该脚本将在Matlab实例中运行,但MCC给我一个我不太明白的错误:

Compiler version: 5.1 (R2014a)
Dependency analysis by REQUIREMENTS.
Error using matlab.depfun.internal.MatlabSymbol/proxy (line 405)
Internal1 Error: Could not determine class of method
"/home/me/MyCode/@tsd/Data.m". Number of classes checked:
17.

@ tsd / tsd.m看起来像这样:

function tsa = tsd(t, Data)

% tsd  Creates tsd object (tsd = class of timestamped arrays of data)
%
% tsa = tsd(t, Data)
%
% INPUTS: 
%       t - list of timestamps - must be sequential, but don't have to be continuous
%       Data - data, possibly an array. If data is n-dimensional, then time should be the FIRST axis.
% OUTPUTS: 
%       tsa - a tsd object
%
% Completely compatible with ctsd.
%
% Methods
%    tsd/Range     - Timestamps used
%    tsd/Data      - Returns the data component
%    tsd/DT        - Returns the DT value (mean diff(timestamps))
%    tsd/StartTime - First timestamp
%    tsd/EndTime   - Last timestamp
%    tsd/Restrict  - Keep data within a certain range
%    tsd/CheckTS   - Makes sure that a set of tsd & ctsd objects have identical start and end times
%    tsd/cat       - Concatenate ctsd and tsd objects
%    tsd/Mask      - Make all non-mask values NaN
%
% ADR 1998, version L4.0, last modified '98 by ADR

% RELEASED as part of MClust 2.0
% See standard disclaimer in ../Contents.m


if nargin == 0
 tsa.t = NaN;
 tsa.data = NaN;
 tsa = class(tsa, 'tsd');
 return
end 

if nargin < 2
  error('tsd constructor must be called with T, Data');
end

tsa.t = t;
tsa.data = Data;

tsa = class(tsa, 'tsd');

和Data.m文件:

function v = Data(tsa, ix)

% tsd/Data  Retrieves data from tsd
%
%   d = Data(tsa)
%   d = Data(tsa, ix)
%
% INPUTS:
%       tsa - tsd object
%       ix - alignment list (timestamps)
% OUTPUTS:
%       v - the tsa.Data
%
%   if called with alignment list, returns those tsa.Data(ix)
%   if called without, returns complete tsa.Data
%
% ADR 1998, version L4.1, last modified '98 by ADR

% RELEASED as part of MClust 2.0
% See standard disclaimer in ../Contents.m


switch nargin
case 2
   f = findAlignment(tsa, ix);
   v = SelectAlongFirstDimension(tsa.data,f);
case 1
   v = tsa.data;
otherwise
   error('Unknown number of input arguments');
end

因此调用tsd函数的脚本只在Matlab会话中运行,但编译器会抛出上述错误。这是我第一次使用Matlab,我完全难过了。还有另一个类有一个名为“Data”的方法,但这不应该导致这个问题,不是吗?

1 个答案:

答案 0 :(得分:0)

我遇到了完全相同的问题,并且能够找到解决方法。

当我使用命令

编译MATLAB库时,我遇到了这个问题
mcc -W cpplib:LibName -T link:lib main.m -a './' -d 'dll_destintaion_dir'

LibName:DLL名称
main.m:MATLAB入口点
dll_destintaion_dir:将存储创建DLL的目标

当我使用此命令编译

时,错误消失了
mcc -W cpplib:LibName -T link:lib main.m -a 'full_path_of_project_folder/*' 
-d 'dll_destintaion_dir'

注意:此方法不会递归地向归档添加文件夹。因此,必须在上面显示的命令中使用另一个-a标志显式添加子文件夹。