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)
Asked
Active
Viewed 9,260 times
4

Ben Hollier
- 585
- 2
- 11
- 32
-
1Related - https://stackoverflow.com/a/12124708/241631 – Praetorian Feb 23 '15 at 21:09
1 Answers
15
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
.

HavelTheGreat
- 3,299
- 2
- 15
- 34
-
Thank you, It works perfectly! Oddly, in the documentation it says you should put `#include
` before anything else – Ben Hollier Feb 23 '15 at 21:17