Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Error: '::hypot' has not been declared" in cmath while trying to embed Python

Tags:

c++

python

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)

like image 381
Orfby Avatar asked Dec 05 '22 22:12

Orfby


1 Answers

Try adding

#include <cmath>

before including Python when compiling.

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.

like image 119
HavelTheGreat Avatar answered Dec 31 '22 02:12

HavelTheGreat