c++ - LNK2019: the object file of my main class cannot find the definition of a class i declared and defined -
so have lnk2019 error on constructor , destructor of class classifier. error exists on method classify. see, defined in .cpp file. overlooking?
here 3 errors: neutropenia_main.obj:-1: error: lnk2019: unresolved external symbol "public: __cdecl classifier::classifier(class qobject *)" (??0classifier@@qeaa@peavqobject@@@z) referenced in function "private: void __cdecl neutropenia_main::on_ts_classifier_clicked(void)" (?on_ts_classifier_clicked@neutropenia_main@@aeaaxxz)
neutropenia_main.obj:-1: error: lnk2019: unresolved external symbol "public: virtual __cdecl classifier::~classifier(void)" (??1classifier@@ueaa@xz) referenced in function "private: void __cdecl neutropenia_main::on_ts_classifier_clicked(void)" (?on_ts_classifier_clicked@neutropenia_main@@aeaaxxz)
neutropenia_main.obj:-1: error: lnk2019: unresolved external symbol "public: void __cdecl classifier::classify(class std::vector >,class patient_data)" (?classify@classifier@@qeaaxv?$vector@vpatient_data@@v?$allocator@vpatient_data@@@std@@@std@@vpatient_data@@@z) referenced in function "private: void __cdecl neutropenia_main::on_ts_classifier_clicked(void)" (?on_ts_classifier_clicked@neutropenia_main@@aeaaxxz)
here use of class classifier.
#include "neutropenia_main.h" #include "ui_neutropenia_main.h" #include "qobject" #include "xlsxdocument.h" #include "xlsxworksheet.h" #include "xlsxworkbook.h" #include "qtcore" #include "xlsxcell.h" #include "xlsxcellrange.h" #include "xlsxcellreference.h" #include "patient_data.h" #include <vector> #include <stdlib.h> #include "classifier.h" #include <qwidget> void neutropenia_main::on_ts_classifier_clicked() { int bottomrow = bottomleft.row(); ui ->classification_table->setrowcount(bottomrow); ui ->classification_table->setcolumncount(3); classifier cl; qstringlist headers; headers << "patient number" << "classification" << "actual"; int = 0; qvariant case; qvariant classified; qvariant actual; (auto current: patients) { if (current.getvalid()) { cl.classify(patients,current); case = current.getcasenumber(); ui -> classification_table -> setitem(i,0,new qtablewidgetitem(case.tostring())); ui -> classification_table -> setitem(i,2,new qtablewidgetitem(current.stringneut(current.getneut()))); if (cl.currentvsneutropenic.sd[0] < cl.currentvsnonneutropenic.sd[0]) { ui -> classification_table ->setitem(i,1,new qtablewidgetitem("yes")); classified = "yes"; }else if (cl.currentvsnonneutropenic.sd[0] > cl.currentvsnonneutropenic.sd[0]) { ui -> classification_table -> setitem(i,1,new qtablewidgetitem("no")); classified = "no"; }else{ classified = "same sd"; ui -> classification_table -> setitem (i,1,new qtablewidgetitem("same sd")); } } classifiedpatients temp; temp.case = case; temp.classifed = classified; temp.actual = current.stringneut(current.getneut()); classified.push_back(temp); } } here .h file of classifier #ifndef classifier_h #define classifier_h #include "patient_data.h" #include <qobject> #include <vector> #include <stdlib.h> class classifier : public qobject { q_object public: explicit classifier(qobject *parent = 0); ~classifier(); void classify(std::vector<patient_data>data, patient_data i); struct createsdtable { std::vector<int>sum[3]; //element 0 = tumor, element 1 = stage, element 2 = adjuvant std::vector<long>mean[3]; std::vector<long>error[3]; std::vector<long>sdl[3]; std::vector<long>sd[3]; }; createsdtable currentvsneutropenic; createsdtable currentvsnonneutropenic; private: std::vector<int> calculatesums(std::vector<patient_data> data, patient_data i); std::vector<long> calculatemean(std::vector<int>validpatients, createsdtable neut, createsdtable nonneut); std::vector<long>calculateerror(patient_data d, std::vector<int>m); std::vector<long>calculatsdl(int nvp, createsdtable cvn, createsdtable cvsnn); int numofvalidpatients(patient_data x); //void classify(std::vector<patient_data>data, patient_data i); signals: public slots: }; #endif // classifier_h #include "classifier.h" #include "patient_data.h" #include <vector> #include <stdlib.h> #include <math.h> classifier::classifier(qobject *parent) : qobject(parent) { } void classifier::classify(vector<patient_data> data, patient_data i) { int numvalidpatients = numofvalidpatients(data); if (i.getvalid()) { neutropenic n; std::vector<long>temp = sums(data,i, n); while (j < 3){currentvsnonneutropenic.sum[j] = temp[j];} while(j > 3){currentvsneutropenic.sum[j] = temp[j+3];} temp = calculatemean(numvalidpatients,currentvsneutropenic,currentvsnonneutropenic); while (j < 3){currentvsnonneutropenic.mean[j] = temp[j];} while(j > 3){currentvsneutropenic.mean[j] = temp[j+3];} temp = calculateerror(data,mean); while (j < 3){currentvsnonneutropenic.error[j] = temp[j];} while(j > 3){currentvsneutropenic.error[j] = temp[j+3];} temp = calculatesdl(numvalidpatients,currentvsneutropenic,currentvsnonneutropenic); while (j < 3){currentvsnonneutropenic.sdl[j] = temp[j];} while(j > 3){currentvsneutropenic.sdl[j] = temp[j+3];} } }
Comments
Post a Comment