错误 C2228:“.x"的左边必须有类/结构/联合 [英] error C2228: left of '.x' must have class/struct/union

查看:704
本文介绍了错误 C2228:“.x"的左边必须有类/结构/联合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到错误,完全不知道为什么!

I am getting the error and have absolutely no idea why!

//create a circle shape.
sf::CircleShape shape;
shape.setRadius(25);
shape.setFillColor(sf::Color(100,250,250));

//circle collision geometry
circle circleTest(shape.getPosition.x,shape.getPosition.y,shape.getRadius())

Circle 是圆形碰撞几何体的类.它在构造函数上失败

Circle is the class for circle collision geometry.And it fails on the constructor

(shape.getPosition.x,shape.getPosition.y,shape.getRadius())

(shape.getPosition.x,shape.getPosition.y,shape.getRadius())

我不知道为什么我收到错误,它工作正常然后突然给了我标题中的错误.

I don't know why i got the error , it worked fine then all of a sudden gave me the error in the title.

推荐答案

getPosition 是一个 函数.您必须调用它并访问其返回值的成员.

getPosition is a function. You must call it and access its return value’s members.

这篇关于错误 C2228:“.x"的左边必须有类/结构/联合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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