【问题标题】:'::hypot' has not been declared'::hypot' 尚未声明
【发布时间】:2017-07-05 17:50:26
【问题描述】:

我正在使用python3.6 theano, 安装了mingw-w64-x86-64,我的操作系统是Win10_64,安装了cuda, 似乎一切都很好

theano.test() 没问题,说明我的 gpu 工作正常,

但它只是一直告诉我“错误:'::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. ", 

任何帮助将不胜感激!

【问题讨论】:

  • 看起来你搞砸了你的编译器设置。

标签: python c++ machine-learning theano


【解决方案1】:

对我有用的是使用上述答案的组合:

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

【讨论】:

    【解决方案2】:

    (这个答案原贴在cmets)

    我必须保留原始的 mingw cmath 标头(否则 libpng 将无法构建),并且我在 pyconfig.h 中注释掉了 #define hypot _hypot(第 241 行)。

    【讨论】:

      【解决方案3】:

      我在使用 mingw32 构建 python 文件时遇到了这个错误。 我打开了它说的文件 (C:/mingw64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/cmath:1157:11)
      并将该行更改为

      using ::_hypot;
      

      或在此之前添加这一行:

      #define hypot _hypot
      

      然后问题就解决了!! 我知道这不是一个基本的解决方案,但它是我能找到的!

      【讨论】:

      • 哦,是的!它适用于 ...\mingw-w64\mingw64\lib\gcc\x86_64-w64-mingw32\8.1.0\include\c++\cmath :1121
      • github.com/Theano/Theano/issues/4926 还建议将 THEANO_FLAGS='gcc.cxxflags="-D_hypot=hypot"' 添加到环境变量中。
      • 我必须保留原始的 mingw cmath 标头(否则不会构建 libpng),并且我在 pyconfig.h 中注释掉了 #define hypot _hypot(第 241 行)。为我工作。
      • 我强烈建议不要编辑系统头文件,因为它只会在您将编译器用于其他项目的任何其他时间弄乱事情,并可能导致奇怪后果的“蝴蝶效应”。
      【解决方案4】:

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

      【讨论】:

        猜你喜欢
        • 2015-04-25
        • 2011-01-22
        • 2017-05-18
        • 2019-09-19
        • 2012-12-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多