Menu

#2266 Failed C++11 compile due to missing _hypot

OTHER
closed
nobody
None
Bug
fixed
IINR_-_Include_In_Next_Release
False
2015-07-31
2015-07-30
No

I thought the issue below might be a GCC or porting issue, so I talked to one of the GCC devs about it on a side bar. He stated _hypot was not standard C++, and likely came from MinGW.

$ cat hypot-test.cpp
#include <algorithm>

int main(int argc, char* argv[])
{
                return argc;
}

**********

$ g++ -std=c++11 -O1 hypot-test.cpp -o hypot-test.exe
In file included from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\cmath:44:0,
                 from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\random:38,
                 from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h
:65,
                 from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\algorithm:62,
                 from hpot-test.cpp:1:
c:\mingw\include\math.h: In function 'float hypotf(float, float)':
c:\mingw\include\math.h:635:30: error: '_hypot' was not declared in this scope
 { return (float)(_hypot (x, y)); }

**********

$ g++ --version
g++.exe (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

**********

$ uname -a
MINGW32_NT-6.1 WINDOWS-7-X64 1.0.18(0.48/3/2) 2012-11-21 22:34 i686 Msys

Discussion

  • Keith Marshall

    Keith Marshall - 2015-07-31
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,7 +1,6 @@
     I thought the issue below might be a GCC or porting issue, so I talked to one of the GCC devs about it on a side bar. He stated _hypot was not standard C++, and likely came from MinGW.
    
    -**********
    -
    +~~~~
     $ cat hypot-test.cpp
     #include <algorithm>
    
    @@ -35,3 +34,4 @@
    
     $ uname -a
     MINGW32_NT-6.1 WINDOWS-7-X64 1.0.18(0.48/3/2) 2012-11-21 22:34 i686 Msys
    +~~~~
    
    • status: unread --> closed
    • Resolution: none --> fixed
    • Category: Unknown --> IINR_-_Include_In_Next_Release
     
  • Keith Marshall

    Keith Marshall - 2015-07-31

    Duplicate of [#2250]; already fixed in git repository.

     

    Related

    Issues: #2250