【发布时间】:2018-06-29 10:27:33
【问题描述】:
我正在尝试在我的 Visual C++ 项目中使用 https://github.com/lava/matplotlib-cpp。
我添加了库
Python36-32\libs\python36_d.lib
Python36-32\libs\python3_d.lib
但我仍然收到错误
错误 LNK2019:未解析的外部符号 __imp_PyObject_GetAttrString 在函数“private: __cdecl matplotlibcpp::detail::_interpreter::_interpreter(void)”中引用 (??0_interpreter@detail@matplotlibcpp@@AEAA@XZ) 错误 LNK2019:未解析的外部符号 __imp__Py_NegativeRefcount 在函数“bool __cdecl matplotlibcpp::plot(class std::vector > const &,class std::vector > const &,class std::basic_string,class std::allocator > const & )" (??$plot@NN@matplotlibcpp@@YA_NAEBV?$vector@NV?$allocator@N@std@@@std@@0AEBV?$basic_string@DU?$char_traits@D@std@@V?$分配器@D@2@@2@@Z) 错误 LNK2019:未解析的外部符号 __imp__Py_Dealloc 在函数“bool __cdecl matplotlibcpp::plot(class std::vector > const &,class std::vector > const &,class std::basic_string,class std::allocator > const & )" (??$plot@NN@matplotlibcpp@@YA_NAEBV?$vector@NV?$allocator@N@std@@@std@@0AEBV?$basic_string@DU?$char_traits@D@std@@V?$分配器@D@2@@2@@Z) ...
我还需要补充什么?
现在可以构建了。我不知道发生了什么。现在我在这个地方遇到运行时错误
PyObject* matplotlibname = PyString_FromString("matplotlib");
PyObject* pyplotname = PyString_FromString("matplotlib.pyplot");
PyObject* pylabname = PyString_FromString("pylab");
if (!pyplotname || !pylabname || !matplotlibname) {
throw std::runtime_error("couldnt create string");
}
PyErr_Print()给了
ImportError: numpy.core.multiarray 导入失败
【问题讨论】:
标签: python c++ visual-studio visual-c++ unresolved-external