Borrar filtros
Borrar filtros

error LNK2019: unresolved external symbol referenced in function mexFunction

7 visualizaciones (últimos 30 días)
I am trying to compile a .cpp file along with a library extension, but I am getting the LNK2019 error. I've looked at all of the similar threads on here and have not been able to fix the issue, so any help you can provide is appreciated. I am not experienced in C++ so I'm guessing my issue is somewhere in the cpp file. I downloaded this whole package from GitHub so I have not written any of it except for modifying the opencv_path string.
This is my MATLAB code:
opencv_path = 'OpenCV2.2/'
openCVflags = ['-I' opencv_path 'include/ -L' opencv_path 'lib/ -lopencv_core220 -lopencv_highgui220 -lopencv_imgproc220'];
system(['mex -outdir bin ' openCVflags ' source/utils/get_video_info.cpp']);
And here is the get_video_info.cpp code:
#include <stdio.h>
#include <stdlib.h>
#include "mex.h"
#include "opencv/cv.h"
#include "opencv/highgui.h"
using namespace std;
using namespace cv;
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
CvCapture* capture = NULL;
char *filename = mxArrayToString(prhs[0]);
double *x, *y, *z;
capture = cvCaptureFromFile(filename);
if (capture == NULL){
mexErrMsgTxt("Could not open video file.txt.");
y = mxGetPr( plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL) );
*y = cvGetCaptureProperty(capture,CV_CAP_PROP_FRAME_HEIGHT );
x = mxGetPr( plhs[1] = mxCreateDoubleMatrix(1,1,mxREAL) );
*x = cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH);
z = mxGetPr( plhs[2] = mxCreateDoubleMatrix(1,1,mxREAL) );
*z = cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_COUNT);

Respuesta aceptada

Esha Bhargava
Esha Bhargava el 12 de En. de 2018
Since the cpp file has been written by a third party, you will need to contact the author of the file to resolve issues related to the file.

Más respuestas (0)


Más información sobre MATLAB Compiler en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by