MATLAB Answers

What is tmwtypes.h and how do I fix an error of it not being seen? Also, general Coder questions.

150 views (last 30 days)
Blaine Minden
Blaine Minden on 17 Dec 2018
Commented: Ken Buckholtz on 4 Feb 2020
So, I've got a function that runs in MATLAB and I have used the MATLAB Coder to convert to C/C++ code. I am doing this to get the MATLAB code onto an existing Android App. I have followed the "MATLAB to iPhone and Android Made Easy" this far. The code compiles and I can move it into my cpp file. When I compile my app, I get an error that says my code can't find "tmwtypes.h." I'm curious first as to what it does/means and how I can fix the error? I am also worried that it might be my makefile that is giving the error.
As a sidenote, I also noticed that the Coder made some .dll files. From my understanding, these won't work on Android so I was curious if maybe that means I am doing something wrong? I have used the Coder to make source code so I think I'm in the right area but I wanted to make this post to be 100% sure.
My code was written in 2014b MATLAB but I am using R2018a for compiling and the Microsoft Windows SDK v7.1. My target device is Generic and Unspecified (assume 32-bit Generic).
Thanks,
Blaine Minden

  2 Comments

Anakin Zheng
Anakin Zheng on 18 Dec 2018
Hi Blaine,
Can you share some details about how you compile the code? Since 18a does not support SDK 7.1, I assume you write your own Makefile. Can you share more details?
Thanks
Anakin
Blaine Minden
Blaine Minden on 18 Dec 2018
Hello,
I forgot to check compatibility when I moved to 18a. I am now compiling using Microsoft Visual C++ 2017 v15.0. I have packaged that code and then moved it into my app's cpp folder. What should my next step be? I saw in the "MATLAB to Android Made Easy" that you are supposed to use an Android.mk file but I'm not really sure how to do that. It seems like the video is kind of dated because most people have moved to Android Studio instead of using a plugin in Eclipse. I have a decent understanding of how this is supposed to work, but I'm not sure how to get there.
Thanks
Blaine Minden

Sign in to comment.

Answers (2)

Mordechai Rorvig
Mordechai Rorvig on 21 Jan 2019
Hi Blaine,
The file tmwtypes.h contains type definitions that are needed by the generated code. You can read more about it in the doc page Mapping MATLAB Types to Types in Generated Code. If you use the packNGo function, the tmwtypes.h file is zipped up with the rest of the generated code files (if it is needed). You can then use that zip file to transfer all the needed files for your generated code. If you use this method then the tmwtypes.h file stored with the rest of the source files should be discoverable by your compiler.
The presence of dll files does not indicate that anything is wrong about your generated C source files. MATLAB Coder generates dll files, for example, if you have chosen a dynamic library for your code generation configuration object:
cfg = coder.config('dll');
For your hardware settings, you will want to select your device on the Hardware pane of the configuration settings.
open cfg;
Choose 'None - Select device below' for Hardware Board and then set the Device vendor and Device type to match the specifications of your external device. These settings control the hardware implementation parameters and other assumptions which can be important for attaining the correct generated code behavior on the target device.

  1 Comment

Ken Buckholtz
Ken Buckholtz on 4 Feb 2020
Embedded coder is packing up the need for "rtwtypes.h". When embedding all the generated code back into an S-Function builder, certain types (e.g. byte_T) have already been defined by "tmwtypes.h". S-function builder throws an error because of the redefinition in "rtwtypes.h"

Sign in to comment.


Sign in to answer this question.

Products


Release

R2018a