bernie2436
bernie2436

Reputation: 23911

I am not calling max -- but the C++ compiler in xcode is saying no matching function for call to max

I am new to C++. In xcode 5, this line of code is throwing the error, "no matching function for call to max." But I'm not calling max! What's going on?

springfact += clamp (0, ff.compression - 0.05, 0.12) * 3000; //no matching function for call to max

Upvotes: 0

Views: 400

Answers (1)

Daniel Frey
Daniel Frey

Reputation: 56883

clamp() calls max(). From its documentation, clamp takes a minimum and a maximum value and "clamps" the value parameter between it, so it most likely is implemented like this:

clamp(min_value,value,max_value) -> min(max(min_value,value),max_value)

The error message is pointing you to the line you see because clamp is probably implemented as a macro but for some reason max is not declared/defined.

Upvotes: 1

Related Questions