Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Legacy Code Tool / Linker Error LNK2019 and LNK1120

$
0
0
Hi,

i'm trying to import existing c-code into simulink via using Legacy Code Tool (LCT) and getting two linker errors (see topic) which i am not able to understand.

The LCT configuration is as followed:

def=legacy_code('initialize');
def.HeaderFiles={'nap_control.h','nap_control_alg.h','types.h'};
def.SourceFiles={'nap_control.c','nap_control_alg.c'};
def.SFunctionName ='nap_control_LCT';
def.OutputFcnSpec ='napControl_GetCosPhi (single y1[1], uint8 u1, uint8 u2, single u3, single u4, boolean u5, single u6, boolean u7)';
legacy_code('sfcn_cmex_generate',def);
legacy_code('compile', def);
legacy_code('slblock_generate', def);

After typing the LCT-command "legacy_code('compile', def);" i get following error message:

### Start Compiling nap_control_LCT
    mex('nap_control_LCT.c', 'C:\Users\Markus\Documents\MATLAB\nap_control_test_leg_code_tool\nap_control.c', 'C:\Users\Markus\Documents\MATLAB\nap_control_test_leg_code_tool\nap_control_alg.c', '-IC:\Users\Markus\Documents\MATLAB\nap_control_test_leg_code_tool')
   Creating library C:\Users\Markus\AppData\Local\Temp\mex_xuJoAx\templib.x and object C:\Users\Markus\AppData\Local\Temp\mex_xuJoAx\templib.exp
nap_control_LCT.obj : error LNK2019: unresolved external symbol napControl_GetCosPhi referenced in function mdlOutputs
nap_control_LCT.mexw64 : fatal error LNK1120: 1 unresolved externals
 
  C:\PROGRA~1\MATLAB\R2011B\BIN\MEX.PL: Error: Link of 'nap_control_LCT.mexw64' failed.
 
Error using mex (line 206)
Unable to complete successfully.

Error in C:\Program
Files\MATLAB\R2011b\toolbox\simulink\simulink\+legacycode\@LCT\compile.p>compile
(line 268)


Error in C:\Program
Files\MATLAB\R2011b\toolbox\simulink\simulink\+legacycode\@LCT\legacyCodeImpl.p>legacyCodeImpl
(line 84)


Error in legacy_code (line 87)
[varargout{1:nargout}] = legacycode.LCT.legacyCodeImpl(action, varargin{1:end});

MATLAB-Version: 2011b
Compiler: MS SDK 7.1 (MS C++ 2010 Express was delivering the same error message)
System: Windows 7 64bit

Have anyone an idea? Would be nice if someone have some time and could give me some advice,

Daniel

Viewing all articles
Browse latest Browse all 19628

Trending Articles