I want to transform a R package into matlab code, a difficult thing is that this package calls a C++ function.
In matlab document I found Call C/C++ Code from MATLAB Code where use coder.cinclude
and coder.ceval
to call a function in C++ code. But when I try it I got the error message below:
Error using coder.ceval (line 63)
The coder.ceval function is not supported in MATLAB.
Then I fount this answer where says "(coder) only works in Simulink but not MATLAB". And sugguested to use clibgen (MATLAB's C/C++ interface) instead.
To use clibgen, I need to install MATLAB Support for MinGW-w64 C/C++ Compiler (only for windows). By the help of the comments of this page I installed it successfully.
Then with this blog MATLAB Speaks C++, I get to use a C++ function in MATLAB.
But if use include <header>
, there still some problem that can't find the header.