【发布时间】:2021-06-26 21:38:28
【问题描述】:
我正在尝试让 Matplotlib 包装器在 wxDevC++ 上工作
代码
#include <cstdlib>
#include <iostream>
#include "matplotlib-cpp/matplotlibcpp.h"
#include <vector>
namespace plt=matplotlibcpp;
using namespace std;
int main(int argc, char *argv[])
{
std::vector<double> y={1,3,2,4};
plt::plot(y);
plt::savefig("minimal.pdf");
cout << "Press the enter key to continue ...";
cin.get();
return EXIT_SUCCESS;
}
我使用的是 Win 7,我有 python 27 和 Python 38。它一直告诉我没有 Python.h 文件。我不知道如何解决这个问题。
【问题讨论】:
-
你有 Python.h 文件吗? Here 在第 5 行你可以看到包含。
-
是的,我有那个文件
-
文件的路径是什么?你如何构建你的项目?你添加那个包含路径吗?你读过documentation,尤其是“安装”部分吗?
-
是的,你是对的。我包含了路径,但现在得到了这个“这个文件需要编译器和库支持即将推出的 ISO C++ 标准 C++0x。这个支持目前是实验性的,必须使用 -std=c++0x 或 -std 启用=gnu++0x 编译器选项。”
-
您从哪里获得编译器以及您使用的编译器/版本是什么? C++0x 是 C++11 的旧名称,这是一个 10 年前的标准。您的编译器默认使用 C++03 或更早版本。它使用 18 年的标准。您可能应该升级您的编译器。我建议至少使用 C++20 或 C++17。
标签: c++ python-2.7 matplotlib compilation windows-7