mex, error C3861: "mxGetDoubles": Cannot find the identifier, "mxGetUint8s": Cannot find the identifier ?

23 次查看(过去 30 天)
When I write the .cpp file and want to generate the .mexw64 library file, I use the mex function to compile, and an error C3861: "mxGetDoubles": identifier not found, "mxGetUint8s": identifier not found, but I can use the "mxGetPr" function to compile .cpp files for normal mex. I am using MATLAB2020b version. According to the help document, the official recommendation is to use mxGetDoubles or mxGetUint8s function instead of mxGetPr function. When I use the mxGetUint8s function to get the output *plhs[] data pointer, the compiler reported the above error, and I found the definition of mxGetUint8s in "matrix.h", and it has been included correctly. Why can't I find the identifier?
#include "mex.h"
#include "matrix.h"
#include "opencv2/opencv.hpp"
...Omit code
mxUint8 *temp,*temp2
temp = (mxUint8*)mxGetUint8s(plhs[0]); // error C3861: "mxGetUint8s": Cannot find the identifier. or "mxGetDoubles" ,use "mxGetPr" instead is OK!
temp2 = (mxUint8*)mxGetUint8s(plhs[1]);
...Omit code
My computer configuration environment:
os: win10
ide: visual studio 2015 professional
matlab: matlab2020b, or matlab2020a
However, compiling and running the code in vs2015 is ok.

采纳的回答

James Tursa
James Tursa 2020-9-29
编辑:James Tursa 2020-9-29
Those functions are for the R2018a memory model API. For that, you need to add the -R2018a option flag:
mex myfile.cpp -R2018a

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Write C Functions Callable from MATLAB (MEX Files) 的更多信息

产品


版本

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by