I'm using a fairly new install of Visual C++ 2008 Express.
I'm trying to compile a program that uses the log2 function, which was found by including using Eclipse on a Mac, but this Windows computer can't find the function (error C3861: 'log2': identifier not found).
The way I understood it, include directories are specific to the IDE, right? math.h is not present in my Microsoft SDKs\Windows\v6.0A\Include\ directory, but I did find a math.h in this directory: Microsoft Visual Studio 9.0\VC\include. There is also a cmath in that directory...
Where is log2?
The log2 function in C computes the base-2 logarithm of x . A domain error occurs if the argument is less than zero. A pole error may occur if the argument is zero.
The log2() function returns the base-2 logarithm of a number. If the number is 0, the log2() function will return -Infinity. If the number is a negative value, the log2() function will return NaN.
From here:
Prototype: double log2(double anumber);
Header File: math.h (C) or cmath (C++)
Alternatively emulate it like here
#include <math.h> ... // Calculates log2 of number. double Log2( double n ) { // log(n)/log(2) is log2. return log( n ) / log( 2 ); }
Unfortunately Microsoft does not provide it.
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