Ask Your Question
0

OPENCV 3.3: ERROR 2019 when call member functions in TrainData [closed]

asked 2017-12-19 02:37:36 -0600

#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.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by m9jiang
close date 2017-12-19 09:07:52.388396

Comments

Not sure that problem origin is opencv : try something like that

LBerger gravatar imageLBerger ( 2017-12-19 02:42:37 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-12-19 06:40:11 -0600

berak gravatar image

updated 2017-12-19 08:43:17 -0600

it should be:

    Mat traindata = tdata->getTrainResponses();

(without the TrainData::)

(( tdata->TrainData::getTrainResponses(); is still "pure virtual" ))

edit flag offensive delete link more

Comments

It works. Thank you so much!

m9jiang gravatar imagem9jiang ( 2017-12-19 09:07:32 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-12-19 02:37:36 -0600

Seen: 292 times

Last updated: Dec 19 '17