简体   繁体   English

成员引用基本类型不是结构或联合

[英]Member reference base type is not a structure or union

I need your help on one of my C++ project. 我需要我的C ++项目之一的帮助。 I've got a semantic issue there : 我那里有一个语义问题:

Image bwImage(Image);
bwImage.setPixel(i,j,Color::Color( image.getPixel(i,j).r * RED + image.getPixel(i,j).g*GREEN + image.getPixel(i,j).b*BLUE,
image.getPixel(i,j).r*RED + image.getPixel(i,j).g*GREEN + image.getPixel(i,j).b*BLUE,
image.getPixel(i,j).r*RED + image.getPixel(i,j).g*GREEN + image.getPixel(i,j).b*BLUE) );

The error message is: 错误消息是:

"Member reference base type sf::Image(sf::Image) is not a structure or union". “成员引用基本类型sf::Image(sf::Image)不是结构或联合”。

Does anyone know where is the problem ? 有人知道问题出在哪里吗?

Thanks ! 谢谢 !

C++ is case sensitive. C ++区分大小写。 Image is the class name, while image is your object that instanciate the class. Image是类名,而image是实例化该类的对象。

From this Documentation , sf::Image has a copy constructor: 从本文档中sf::Image具有副本构造函数:

sf::Image::Image    (   const Image &   Copy    )   

You can build the bwImage , using that copy constructor, passing a reference to your image object. 您可以使用该复制构造函数构建bwImage ,并将引用传递给您的image对象。

So first line: 所以第一行:

Image bwImage(Image);

Should be: 应该:

Image bwImage(image);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 成员参考库类型不是结构或联合 - Member Reference Base Type Not a Structure or Union 成员引用基类型“Point *”不是结构体或联合体? - Member reference base type 'Point *' is not a structure or union? 成员引用基本类型“ double”不是结构或联合 - Member reference base type 'double' is not a structure or union 成员引用基类型“int”不是结构或联合 - Member reference base type 'int' is not a structure or union 成员引用基类型不是结构或联合 - Member reference base type is not a structure or a union 成员引用基类型 &#39;std::vector<char> *[10]&#39; 不是结构体或联合体 - Member reference base type 'std::vector<char> *[10]' is not a structure or union 成员参考基础类型&#39;节点 <int> *&#39;不是结构或联盟 - Member Reference Base Type 'Node<int> *' Is Not A Structure Or Union 成员引用基类型“elem *”不是结构或联合 C++ - Member reference base type 'elem *' is not a structure or union C++ C ++成员参考基本类型&#39;Vertex * const&#39;不是结构或联合 - C++ Member Reference base type 'Vertex *const' is not a structure or union 实现观察者模式的问题:“成员引用基类型 ________ 不是结构或联合” - Problem Implementing Observer Pattern : “Member reference base type ________ is not a structure or union”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM