I am attempting to convert a tool from C to C++ so I can compile as a CLR. I am a .NET guy so this is well outside my comfort zone.
I have a compile error on the following line (tell me if this is not enough information):
if (qvartype[ currQ ] == FLOATING )
*range *= get_scale( currQ ); /* Make range units match */
/* data units. */
currQ
is a short
. The error is defined on the get_scale
function. This function is defined earlier as:
#define get_scale( i ) ((short)pow( 10, (int)((long)(cat_names[ i ]))))
...which looks ridiculous to me, deep into type casting hell, but it does compile in C. However, in C++, I get the following error message:
Error 374 error C2668: 'pow' : ambiguous call to overloaded function
I understand C does not employ the concept of overloads, but C++ does, and the variable signature on this hot mess makes it unclear which function to invoke.
How do I fix this? What would be the right way to write this for maximum compatibility with C++?
There is no overloaded version of pow() in C++ which satisfies your calling signature of (int, int)
. One of the supported calling conventions is (double, int)
so modifying your call to:
pow(10.0, ...)
should be enough
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With