2015-02-23 68 views
2

在嘗試使用#include <Python.h>將Python嵌入到我的程序中出現問題後,我終於找到它來找到所有正確的庫,但是我有另一個錯誤。當我嘗試使用#include <Python.h>進行編譯時,它將我重定向到我的code :: blocks目錄中的cmath,並將一個錯誤標記放在using ::hypot;這一行,並說:error: '::hypot' has not been declared。我不知道爲什麼這是一個錯誤,特別是因爲這是與我的code :: blocks安裝一起發生的,而且我猜想,因爲Python試圖包含它。我在Windows上,並使用Python的最新版本(3.4.2)「Error:'hypot'has not declare」in cmath while try to嵌入Python

+0

相關 - https://stackoverflow.com/a/12124708/241631 – Praetorian 2015-02-23 21:09:56

回答

10

嘗試增加

#include <cmath> 

包括Python編譯時之前。

您的錯誤是由於hypot被重命名爲_hypot而造成的pyconfig頭文件。 cmath期待看到hypot而不是_hypot

+0

謝謝,它完美的作品!奇怪的是,在文檔中,它說你應該把#include 放在其他的東西之前 – Orfby 2015-02-23 21:17:45