4

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 Feb 23, 2015 at 21:01
1

1 Answer 1

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.

answered Feb 23, 2015 at 21:04
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, It works perfectly! Oddly, in the documentation it says you should put #include <Python.h> before anything else

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.