Reputation: 1948
This is the situation:
int f(int a){
...
g(a);
...
}
void g(int a){...}
The problem is that the compiler says that there is no matching function for call to g(int&). It wants me to pass the variable by reference and g() recieves parameters by value.
How can I solve this?
Upvotes: 0
Views: 236
Reputation: 2774
There are two things wrong:
1) g is not declared before it is used, so the compiler will compain about that. Assuming you fixed that issue, then the next issue is:
2) f is not returning an int.
Upvotes: 0
Reputation: 12044
Well, there's not much here, but the first thing is: make sure you have a declaration for g that's included before f is defined.
void g(int a);
Otherwise, when you get to f, function f has no idea what function g looks like, and you'll run into trouble. From what you've given so far, that's the best I can say.
Upvotes: 12