'::hypot' has not been declared
Asked Answered
A

4

8

I'm using python3.6 theano, with mingw-w64-x86-64 installed, my os is Win10_64, cuda installed, and seems everything is ok

the theano.test() is ok, saying my gpu is working,

but it just keeps tell me that "error: '::hypot' has not been declared"

 C:/mingw64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/cmath:1157:11: error: '::hypot' has 
 not been declared\r.    using ::hypot;\r.            ^~~~~\r. ", 

Any help would be appreciated!

Aspire answered 16/2, 2017 at 14:38 Comment(1)
Looks like you botched your compiler setup.Waive
F
16

I had this error with building an python file using mingw32 . I opened the file that it says (C:/mingw64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/cmath:1157:11)
and changed that line to

using ::_hypot;

or adding this line just before that :

#define hypot _hypot

and after that the problem was solved !! I know it's not a basic solution but it is the one that I could find !!

Fanni answered 1/11, 2017 at 15:40 Comment(4)
Oh, yes! It works for ...\mingw-w64\mingw64\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\cmath : 1121Bandoline
github.com/Theano/Theano/issues/4926 also advises to add THEANO_FLAGS='gcc.cxxflags="-D_hypot=hypot"' to the environment variables.Bandoline
I had to keep the original mingw cmath header (otherwise libpng would not build) and I commented out the #define hypot _hypot in pyconfig.h (line 241). Worked for me.Chrystalchryste
I'd strongly recommend against editing system header files as it will just munt things up for any other times you use the compiler for other projects, and could lead to a "butterfly effect" of weird consequences .Marcusmarcy
M
2

(This answer was posted in comments originally)

I had to keep the original mingw cmath header (otherwise libpng would not build) and I commented out the #define hypot _hypot in pyconfig.h (line 241).

Marcusmarcy answered 16/2, 2017 at 14:38 Comment(0)
B
1

What worked for me was to use the combination of the answers above:

#ifdef _WIN64
#define _hypot hypot
#include <cmath>
#endif
#include <pybind11.h>
Berndt answered 13/1, 2021 at 2:16 Comment(0)
O
0

My guess from your incomplete information is that you aren't compiling in C++11 mode so you aren't picking up ::hypot from C99.

Outtalk answered 16/2, 2017 at 17:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.