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

• 10-19-2008
misterMatt
error C2064: term does not evaluate to a function taking 2 arguments
Hey guys, I'm trying to create a little program here, but I'm having some trouble with it.

I'm getting the following error message: error C2064: term does not evaluate to a function taking 2 arguments. I don't really kn ow what the hell that means, would someone mind pointing out what the problem is so I can fix it? I was under the impression that a function as an argument was perfectly cool to do. Anyway, here are the two offensive lines, followed by the function definitions.

Code:

``` //bad lines x += delta_x((velocity_x(user_velocity, DEGREES)), t); y -= delta_y((velocity_y(user_velocity, DEGREES)), t); //function definitions: double velocity_x(int vel, int degrees){         return vel * cos(degrees * 3.141592654/180.0); } double velocity_y(int vel, int degrees){         return vel * sin(degrees * 3.141592654/180.0); } double delta_x(double vel_x, double time){         return vel_x * time; } double delta_y(double vel_y, double time){         return vel_y * time - (.5 * (9.8 * (time*time))); }```
Any help would be greatly appreciated, because I have no idea what is wrong.
• 10-19-2008
tabstop
Do you have prototypes for your functions?
• 10-19-2008
misterMatt
yes I do, at the top of my file:

Code:

```double velocity_x(int vel, int degrees); double velocity_y(int vel, int degrees); double delta_x(double vel_x, double time); double delta_y(double vel_y, double time);```
• 10-19-2008
tabstop
Good. Then you're not getting that error. (No really. I just compiled it, and you're not getting any error at all.)
• 10-19-2008
misterMatt
I'm confused. It still fails compilation for me.
• 10-19-2008
tabstop
It shouldn't make a difference, but remove the superfluous parentheses around the function calls and see if that helps. After that, I don't know. I'm using VS2008; I don't know what version you have, but you may need to yell.
• 10-19-2008
laserlight
Quote:

Originally Posted by misterMatt
I'm confused. It still fails compilation for me.

Provide the smallest and simplest complete program that demonstrates the error.
• 10-19-2008
Salem
x += delta_x((velocity_x(user_velocity, DEGREES)), t);
y -= delta_y((velocity_y(user_velocity, DEGREES)), t);
You've got local variables with the same names in whatever function you've got this code in.

One way out
Code:

```x += delta_x((::velocity_x(user_velocity, DEGREES)), t); y -= delta_y((::velocity_y(user_velocity, DEGREES)), t);```
• 10-20-2008
Elysia
It's better to rename the functions (and/or the variables) to something different.
• 10-20-2008
master5001
Off topic...

Code:

```#include <math.h> double velocity_x(int vel, int degrees){         return vel * cos(degrees * M_PI/180.0); } double velocity_y(int vel, int degrees){         return vel * sin(degrees * M_PI/180.0); }```