简体   繁体   English

'::hypot' 尚未声明

[英]'::hypot' has not been declared

I'm using python3.6 theano, with mingw-w64-x86-64 installed, my os is Win10_64, cuda installed, and seems everything is ok我正在使用 python3.6 theano,安装了 mingw-w64-x86-64,我的操作系统是 Win10_64,安装了 cuda,似乎一切正常

the theano.test() is ok, saying my gpu is working, theano.test() 没问题,说我的 gpu 正在工作,

but it just keeps tell me that "error: '::hypot' has not been declared"但它一直告诉我“错误:'::hypot'尚未声明”

 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!任何帮助,将不胜感激!

I had this error with building an python file using mingw32 .我在使用 mingw32 构建 python 文件时遇到了这个错误。 I opened the file that it says (C:/mingw64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/cmath:1157:11)我打开了它说的文件 (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 !!我知道这不是一个基本的解决方案,但它是我能找到的解决方案!!

(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).我必须保留原始的 mingw cmath 标头(否则 libpng 不会构建),并且我在pyconfig.h (第 241 行)中注释掉了#define hypot _hypot pyconfig.h

根据您的不完整信息,我的猜测是您没有在 C++11 模式下进行编译,因此您没有从 C99 中获取::hypot

What worked for me was to use the combination of the answers above:对我有用的是使用上述答案的组合:

#ifdef _WIN64
#define _hypot hypot
#include <cmath>
#endif
#include <pybind11.h>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM