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

23 views (last 30 days)
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.

Accepted Answer

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

More Answers (0)

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!