Unresolved externals when creating a mex function
조회 수: 8 (최근 30일)
이전 댓글 표시
I am creating a simple mex function for the OpenCV imread() function. This will allow me to read freames from a camera stream.
I receive an error stating that I have two, unresolved externals as shown below:
error LNK2019: unresolved external symbol "class cv::Mat __cdecl cv::imread(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &,int)"
I am able to use the imread() functionality directly from Visual Studio in my Python and C++ scripts so there is no problem with my OpenCV download. In the code that I have pasted below, all functionallity with the cv::createBackgroundSubtractorMOG2() works perfectly. ie: when I compile the mex function with only that functionallity, it works fine.
Why is it that functionallity with the cv::createBackgroundSubtractorMOG2() works fine but when I add in the imread() function it gives me the errors.
This is my code:
#include "opencvmex.hpp"
using namespace cv;
static Ptr<BackgroundSubtractorMOG2> ptrBackgroundModel = cv::createBackgroundSubtractorMOG2();
// Static smart pointer to hold the loaded image
static Ptr<Mat> ptrImage = makePtr<Mat>();
// Function to load an image from a file
void loadImageFromFile(const std::string& filename) {
// Load the image from file
Mat image = cv::imread(filename);
// Assign the loaded image to the static smart pointer
*ptrImage = image;
}
댓글 수: 2
James Tursa
2024년 5월 3일
편집: James Tursa
2024년 5월 3일
Why is the error message showing a imread() signature with four arguments but your example code imread() has only one argument? Are there other imread() calls in your code that have four arguments?
Are there multiple libraries you need to link with?
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!