简体   繁体   English

预期表达式出现错误?

[英]Error comes in Expected expression?

在这里,我尝试在GLKVector2Add值中插入一个值,但错误在此行中缺少预期的表达式。

GLKVector2 self.position = GLKVector2Add({-200.695, 271},{-803.695, 0});  //Error - Expected expression

Try creating " GLKVector2 " variables, setting them and then passing those as arguments in your call to " GLKVector2Add ". 尝试创建“ GLKVector2 ”变量,设置它们,然后在调用“ GLKVector2Add ”时将它们作为参数传递。 It may be that the compiler simply doesn't know what to do with "{-200.695,271}" (a mix of float and integer numbers). 可能是编译器根本不知道如何处理“{-200.695,271}”(浮点数和整数数的混合)。

You must add them using GLKVector2Make . 您必须使用GLKVector2Make添加它们。

So, your code will be: 所以,你的代码将是:

GLKVector2 position = GLKVector2Add(
                      GLKVector2Make(-200.695, 271), 
                      GLKVector2Make(-803.695, 0));

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM