I tried to follow this example to know how to use the Legacy Code Tool :
But when I try to use the function legacy_code to create the S-function and the corresponding C MEX with this command :
% legacy_code('compile', def);
I get this error :
% ### Start Compiling ex_sfun_doubleit
mex('-I/Users/..../Desktop/example', '-c', '-outdir', '/private/tmp/tpaa85b6f5_b2e5_4c61_8c6e_17849ff9c5bb', '/Users/..../Desktop/example/doubleIt.c')Building with 'Xcode with Clang'.Error using mexIn file included from /Users/..../Desktop/example/doubleIt.c:1:/Users/nabil/Desktop/example/doubleIt.h:1:2: error: invalid preprocessing directive#ifndef_DOUBLEIT_H_ ^/Users/...../Desktop/example/doubleIt.h:2:2: error: invalid preprocessing directive#define_DOUBLEIT_H_ ^/Users/...../Desktop/example/doubleIt.h:6:2: error: #endif without #if#endif ^3 errors generated. Error in legacycode.LCT/compile (line 352) Error in legacycode.LCT.legacyCodeImpl (line 84) Error in legacy_code (line 87)[varargout{1:nargout}] = legacycode.LCT.legacyCodeImpl(action, varargin{1:end});
I notice Im on Mac OSX Elcapitan 10.11 and Matlab R2015a.
Thanks.
Best Answer