- What you are trying to do
- How you are trying to do it
- At what stage of the process you encounter the error
Problem with compiler C to use int16_t type for translation in Q15 format
8 views (last 30 days)
Show older comments
Hello,
I have a problem with compiler C. I have this error message
Error using legacycode.LCT.legacyCodeImpl
The data type "int16_t" is neither a built-in data type, nor defined by
a Simulink.AliasType, Simulink.NumericType, Simulink.Bus object, or an
enumerated data type:
--> int16_t y1 = ControlloDig(int16_t u1)
Error in legacy_code (line 101)
[varargout{1:nargout}] = legacycode.LCT.legacyCodeImpl(action,
varargin{1:end});
Error in Discretizza_controllo_generazione_sfun (line 77)
legacy_code('sfcn_cmex_generate', def);
I did a function that works in Q15 format but, when I use the script to compile it, Matlab shows an error on the data type "int16_t". If you need the other files i can upload them.
0 Comments
Answers (2)
Sebastian K
on 26 May 2017
Hi there,
I am afraid it will not be possible to provide a very helpful answer based on the limited information you have provided. The error message itself is not quite useful. Ideally you should provide a detailed explanation of:
Just by looking at the error message, I am guessing that you are probably trying to use the Legacy Code Tool to build a C MEX S-function from some hand-written C code.
The main issue looks like the "int16_t" data type is not defined. One potential reason for this could be that you are missing a header file in your C code that contains the data type definition. Try adding the following "include" directive to your C code.
#include <tmwtypes.h>
I hope this helps.
Sebastian
0 Comments
See Also
Categories
Find more on MATLAB Support for MinGW-w64 C/C++ Compiler in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!