我怎么办这个错误Plz? [英] What I Do About This Error Plz?

查看:84
本文介绍了我怎么办这个错误Plz?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  for  int  i =  0 ; i< num_models; i ++){
model [i] .clear();
model [i] .train(samples [i],Mat(),ps,NULL);

cout<< 型号<< i<< 表示:;
const CvMat * m = model [i] .get_means();





错误C2228:'。clear'左边必须有class / struct / union

错误C2678:'['binary:找不到运算符,它带有'std类型的左操作数: :vector'(或者没有可接受的转换)

错误C2228:'.train'的左边必须有class / struct / union

解决方案

< blockquote>检查模型变量的定义 - 它不是你想象的那样,或者至少VS认为它不是你认为的那样! br />
或许,它应该是类似的东西

 MyModelClass模型[ 5 ]; 


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

解决方案

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

MyModelClass model[5];


这篇关于我怎么办这个错误Plz?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆