Ask Your Question

Revision history [back]

OPENCV 3.3: ERROR 2019 when call member functions in TrainData

#include "opencv2/core.hpp"
#include "opencv2/ml.hpp"
#include <cstdio>
#include <vector>
#include <iostream>

using namespace std;
using namespace cv;
using namespace cv::ml;

int main()
{
    string data_filename = "letter-recognition.csv";
    Ptr<TrainData> tdata = TrainData::loadFromCSV(data_filename, 0);
    Mat traindata = tdata->TrainData::getTrainResponses();
    return 0;
}

The code is listed as above. The version is OpenCV 3.3.0. I have check the configuration. I can run the sample letter_recog.cpp correctly. But I have received the error when call member functions getTrainResponses() in TrainData

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol "public: virtual class cv::Mat __cdecl cv::ml::TrainData::getSamples(void)const " (?getSamples@TrainData@ml@cv@@UEBA?AVMat@3@XZ) referenced in function main opencvscvreafer c:\Users\m63jiang\documents\visual studio 2015\Projects\opencvscvreafer\opencvscvreafer\Source.obj  1

for the code listed at the the beginning.

I really do not know how to solve this. I would be grateful if anyone can help.