Reputation: 67
I am having trouble resolving a C:2059 error on lines 19-23. I am certain my creation of a vector data type is correct. Where have I gone wrong?
Debugger Output: C:\Qt\Tools\QtCreator\bin\Neutropenia_Application\classifier.h:21: error: C2059: syntax error : 'constant'
#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<long> sum(3); // C2509 error //element 0 = Tumor, element 1 = Stage, element 2 = Adjuvant
std::vector<long> mean(3); // C2509 error
std::vector<long> error(3); // C2509 error
std::vector<long> SDL(3); // C2509 error
std::vector<long> SD(3); // C2509 error
};
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);
std::vector<int> NumofValidPatients(std::vector<patient_data>x);
//void classify(std::vector<patient_data>data, patient_data i);
*/
signals:
public slots:
};
#endif // CLASSIFIER_H
Upvotes: 1
Views: 4051
Reputation: 2234
You can't initialize member variables that way. You need to separate declaration and initialization:
struct CreateSDTable {
std::vector<int> sum;
...
CreateSDTable() : sum(3), ... {}
};
Upvotes: 2