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

c++, python

Solution

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`.

Problem

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)

Original source

Related problems