Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
for (int i = 0; i<num_models; i++) {
			model[i].clear();
			model[i].train(samples[i], Mat(), ps, NULL);

			cout << "Model " << i << " means: ";
			const CvMat* m = model[i].get_means();


error C2228: left of '.clear' must have class / struct / union
error C2678: '[' binary: no operator found which takes a left operand of type 'std :: vector' (or there is no acceptable conversion)
error C2228: left of '.train' must have class / struct / union
Posted
Comments
[no name] 31-Oct-14 12:14pm    
Seems your Array of model Points not to the class you try to reference
mohamed sabri 31-Oct-14 12:16pm    
i don't understant plz more
[no name] 31-Oct-14 12:21pm    
what is the type of class which model[] holds? does this class/struct has e.g. a method clear()?
Sergey Alexandrovich Kryukov 31-Oct-14 14:38pm    
Bruno meant to say that the object "model[i]" does exist, but it's type is nor class neither struct or union. Not only this type does not have the member "clear()"; it cannot have it, by the nature of this type.
You cannot expect "int obj = 3; obj.clear();" right? This is something like that.
—SA

1 solution

Check the definition of your model variable - it isn't what you think it is, or at least VS doesn't think it is what you think it is!
Probably, it should be something along the lines of
C++
MyModelClass model[5];
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900