Sgrange error on VS2012

Hi,
I have a problem to compile a cpp code on VS2012. The compilation finishes with the following errors:

1>c:\program files\microsoft visual studio 11.0\vc\include\cmath(57): error C2039: 'hypotf' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 11.0\vc\include\cmath(57): error C2873: 'hypotf' : symbol cannot be used in a using-declaration

I searched for the error with no results. I'm migrating from VS2008 and the error appears quite often in the migrated code. Do you have any idea what is the reason? Thanks.
Do you have any idea what is the reason?

Nope

What you prob need to do is select one of the smallest cpp files which repros the problem and rebuild it with the preprocess to file (/P) flag set. Then check the resultant file so see what happened when math.h was being included.

Also check your math. is ok, as that's where the hypotf function should be declared.

Andy
Check this example from MSDN:
http://msdn.microsoft.com/en-us/library/a9yb3dbt%28v=vs.110%29.aspx


Also read this:
_hypotf is only available on Itanium Processor Family (IPF) platforms. _hypot is available on all platforms.
_hypotf is only available on Itanium Processor Family (IPF) platforms. _hypot is available on all platforms.

That's a bit confusing. I've just successfully compiled this exciting program...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <cmath>
using namespace std;

int main() {
    float x = 3.0f;
    float y = 4.0f;

    double h = _hypotf(x, y); // hypotf also works for 2010 and 2012

    cout << "h = " << h << "\n";

    return 0;
}


...and run it...

h = 5

on a 32-bit Intel patform using Visual C++ 2008, 2010, and 2012.

Checking <math.h> for Visual C++ 2010, I find the function is declared in an unguarded block of code (no sign of #ifdef _M_IA64.)

Andy

PS For Visual C++ 2008 _hypotf is guarded by #ifdef, but it's available when _M_IX86, _M_IA64, or _M_AMD64 is defined. So it looks like normal Intel 64-bit processors (_M_X64) were the only losers.
Last edited on
Topic archived. No new replies allowed.