Generate only 2 files for c++ matlab coder
Show older comments
Hi, I'm just getting started with matlab coder to create c++ code from my matlab function. I would like to have just 2 files created for each matlab function, a .cpp file and a .h file, but i'm getting many files generated and i don't understand the usage of those files. My matlab function is simply adding 2 numbers and is called myfunc.m. Matlab coder creates 4 files : myfunc.cpp, myfunc.h ,myfunc_types.h, rtwtypes.h. Moreover, if i try to implement the c++ code in an external c++ project, for example creating a main.cpp function in visual studio code that includes the myfunc.h and calls the function, i always get the error "cannot open source file "tmwtypes.h" ". Looking at the code I can see that at the end of the file rtwtypes.h there is an #include of the tmwtypes.h, obviously the code doesn't find it cause matlab didn't create that file. To use the function in my cpp project i should delete that include and then everything works, but I would like to understand why are they created and how to force matlab to just create the myfunc.cpp and myfunc.h. I leave attached the matlab function i used and the generated c++ files from matlab coder. Hope that you can help me, thanks.
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with MATLAB Coder 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!