Hi!
I'm in need of assistance for a compiler error, that doesnt like me, and me neither since i dont know how to "eraser" it ;-)
the structs look like this (its a template i am enhancing for my coide)
Code:
typedef struct {
int ix;
int iy;
int ic;
} t_fingertip;
/** List containing all fingertips of the classified probe*/
typedef list<t_fingertip> FINGERLIST;
/** Struct containing all global parameters changeable in the GUI */
typedef struct {
int ikValue; //Initial Value of K Parameter
int ikMin; //Min Value for K Parameter (should be 6)
int ikMax; //Max Value for K Parameter (should be around 50?)
int irValue; //Value of radius
int irMin; // Min Value of radius
int irMax; // Max Value of radius
/* float fValue;
float fMin;
float fMax;*/
BOOL bToggle;
BOOL bDrawClassification;
BOOL bIntelliClassification;
int iRadio;
char acFilename[PATH_MAX];
} t_GuiOptions;
/** Struct containing local parameters for processing */
typedef struct {
int iMousePosX;
int iMousePosY;
int iWidth;
int iHeight;
// BOOL bThumbExist;
// BOOL bForefingerExist;
// BOOL bMiddlefingerExist;
// BOOL bRingfingerExist;
// BOOL bLittlefingerExist;
IplImage* ptCvImg;
IplImage* ptCvResult;
IplImage* ptCvVSpace;
t_fingertip ft1;
t_fingertip ft2;
FINGERLIST flist;
} t_LocalVariables;
/** Struct containing parameters for a single fingertip */
/** Streammanipulation for reading and writing the dbfile properly */
ostream& operator<<(ostream& os,const t_fingertip& ft){
os << ft.ix << ';' << ft.iy << ';' << ft.ic << '\n';
return os;
}
t_fingertip& operator>>(istream& is, t_fingertip& ft){
string line;
int first, last;
if (!getline(is, line))
return ft;
first = line.find_first_of(';');
last = line.find_last_of(';');
ft.ix = atoi(line.substr(0, first).c_str());
ft.iy = atoi(line.substr(first + 1, last - (first + 1)).c_str());
ft.ic = atoi(line.substr(last + 1, line.size() - (last + 1)).c_str());
// cout << ft.x << endl;
// cout << ft.y << endl;
// cout << ft.c << endl;
return ft;
}
then i get a compiler error in these lines:
Code:
int loadfile(string filen, t_LocalVariables *ptLocalVars){
string file;
ifstream infile( filen.c_str(), ios::in);
if ( !infile ){
cout << "File " << filen << " failed to load." << endl;
cout << "Using empty state." << endl;
return 0;
}
int i = 0;
while (true) {
if (!infile)
break;
infile >> ptLocalVars.ft1;
ptLocalVars.flist.push_back(ptLocalVars.ft1);
++i;
}
ptLocalVars.flist.pop_back();
--i;
cout << "Loaded " << i << " entries from file " << filen << " ." << endl;
return 0;
}
int savefile(string filen, t_LocalVariables *ptLocalVars){
string file = filen;
ofstream outfile( filen.c_str(), ios::out);
if (!outfile){
cerr << "File " << filen << " failed to open!" << endl;
return 0;
}
typedef list<t_fingertip>::const_iterator ftiter;
for(ftiter i = ptLocalVars.flist.begin();i != ptLocalVars.flist.end();++i)
outfile << *i;
return 1;
}
It says:
classification.cc: In function `int loadfile(basic_string<char,string_char_traits<char >,__default_alloc_template<true,0> >, t_LocalVariables *)':
classification.cc:37: request for member `ft1' in `ptLocalVars', which is of non-aggregate type `t_LocalVariables *'
classification.cc:38: request for member `ft1' in `ptLocalVars', which is of non-aggregate type `t_LocalVariables *'
classification.cc:42: request for member `flist' in `ptLocalVars', which is of non-aggregate type `t_LocalVariables *'
classification.cc: In function `int savefile(basic_string<char,string_char_traits<char >,__default_alloc_template<true,0> >, t_LocalVariables *)':
classification.cc:59: request for member `flist' in `ptLocalVars', which is of non-aggregate type `t_LocalVariables *'
classification.cc:59: request for member `flist' in `ptLocalVars', which is of non-aggregate type `t_LocalVariables *'
make: *** [classification.o] Error 1
Who can help me out please?
THanks in advance!
Jan