“Error:':: hypot'没有被声明为”在cmath同时试图嵌入Python [英] "Error: '::hypot' has not been declared" in cmath while trying to embed Python
问题描述
在尝试使用 #include< Python.h>
将Python嵌入我的程序中遇到一些麻烦后,我终于找到了所有正确的库,有另一个错误。当我尝试使用 #include< Python.h>
编译时,它会将我重定向到我的代码:: blocks目录中的cmath, using :: hypot;
并说:错误:':: hypot'尚未声明
。我不知道为什么这是一个错误,特别是因为这带来了我的代码:: blocks安装,并提出,我想,因为Python试图包括它。我在Windows上,并使用最新版本的Python(3.4.2)
After having some trouble trying to embed Python into my program using #include <Python.h>
, I finally got it to find all the correct libraries, but I have another error. When I try to compile with #include <Python.h>
it redirects me to cmath in my code::blocks directory, and puts an error marker by the line that says using ::hypot;
and says: error: '::hypot' has not been declared
. I have no idea why this is an error, especially because this came with my code::blocks installation, and came up, I assume, because Python tried to include it. I am on Windows, and using the newest version of Python (3.4.2)
推荐答案
尝试添加
#include <cmath>
。
您的错误是 hypot
重命名为 _hypot
在 pyconfig 头文件中。 cmath 希望看到 hypot
,而不是 _hypot
。
Your error is a result of hypot
being renamed to _hypot
in your pyconfig header file. cmath is expecting to see hypot
and not _hypot
.
这篇关于“Error:':: hypot'没有被声明为”在cmath同时试图嵌入Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!