Weird error

Started by
3 comments, last by Zahlman 14 years, 12 months ago
for some rerason, i get this error when i try to set the world bounds for Box2D.


error C2064: term does not evaluate to a function taking 2 arguments


is it something wrong with Box2D? or me? here is how i'm using the functions.


b2AABB World;

World.upperBound(0,0);
World.lowerBound(SCREEN_WIDTH, SCREEN_HEIGHT);


Any ideas on how to fix this error? cause to me it makes no sense. i'm not sure whether it's a Box2D error or a C++ one. so, if you can, please let me know what i can do, thanks.
Advertisement
It looks like you want to call the b2Vec2 constructor on members upperBound and lowerBound. The compiler thinks you're trying to call a method; hence the C2064.

Try:
World.upperBound = b2Vec2(0,0);
World.lowerBound = b2Vec2(SCREEN_WIDTH, SCREEN_HEIGHT);


or look at MikeTacular's answer. [smile]

[Edited by - _fastcall on April 20, 2009 11:31:50 AM]
You should be doing:

World.upperBound.Set(0,0);
World.lowerBound.Set(SCREEN_WIDTH, SCREEN_HEIGHT);

Feel free to take a look at the User Manual if you wish (under the section "4.3.3. AABB Queries")

Or you know, you could just steal the answer from me and edit your post and stick my answer in there... :)
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
that worked,thanks. now i can get about using Box2D. just that error seemed weird. anyways, thanks a bunch
The error is not "weird"; it means exactly what it says.

term does not evaluate to a function taking 2 arguments


A "term" is a small portion of an expression, roughly speaking. Here, the term in question is "World.upperBound" or "World.lowerBound".

"Arguments" is another word for "parameters".

To "evaluate to X" means to have a result of X when evaluated. To evaluate a formula is to perform the calculation that the formula indicates.

Thus, the compiler states that selecting the upperBound member of World does not result in a function that takes two parameters. And indeed it doesn't, because the upperBound member of World is not a function that takes two parameters.

The reason it makes this complaint is that the statement "World.upperBound(0, 0)" is saying to call World.upperBound, passing it 0 and 0 as parameters. It can't do this, because World.upperBound is the wrong type.

This topic is closed to new replies.

Advertisement