Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/155.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在Windows上使用Boost Python 3和numpy3库时,VS2015中存在LNK2019未解析的外部符号_C++_Boost_Boost Python - Fatal编程技术网

C++ 在Windows上使用Boost Python 3和numpy3库时,VS2015中存在LNK2019未解析的外部符号

C++ 在Windows上使用Boost Python 3和numpy3库时,VS2015中存在LNK2019未解析的外部符号,c++,boost,boost-python,C++,Boost,Boost Python,我使用以下命令在Windows上下载并构建了Boost 1.64: b2 --build-type=complete address-model=64 toolset=msvc stage 我在我的主目录中添加了一个user-config.jam文件,告诉Boost在哪里可以找到Python 3: using python : 3.6 : c:\\anaconda3\\python ; 然后,我尝试使用boost::python和boost::numpy编译一个小测试项目: #include

我使用以下命令在Windows上下载并构建了Boost 1.64:

b2 --build-type=complete address-model=64 toolset=msvc stage
我在我的主目录中添加了一个user-config.jam文件,告诉Boost在哪里可以找到Python 3:

using python : 3.6 : c:\\anaconda3\\python ;
然后,我尝试使用boost::python和boost::numpy编译一个小测试项目:

#include <boost/python.hpp>
#include <boost/python/numpy.hpp>

namespace bp = boost::python;
namespace np = boost::python::numpy;

np::ndarray test_make_zeros(int rows, int cols)
{
    return np::zeros(bp::make_tuple(rows, cols), np::dtype::get_builtin<float>());  
}

BOOST_PYTHON_MODULE(test_boost_numpy)
{
    np::initialize();

    bp::def("test_make_zeros", test_make_zeros);
}
我的boost::python库名为boost_python3-vc140-mt-1_64.lib,当链接到python 3.6时,boost::numpy最终成为boost_numpy3-vc140-mt-1_64.lib

我必须打开BOOST\u ALL\u NO\u LIB。如果不是,编译器将查找boost_python-vc140-mt-1_64.lib boost_numpy-vc140-mt-1_64.lib(名称错误,库名称后缺少数字3)。(这是Windows上的错误吗?)

对于我的测试项目,我现在得到以下链接错误:

test_boost_python.obj : error LNK2019: unresolved external symbol "class boost::python::numpy::dtype __cdecl boost::python::numpy::detail::get_float_dtype<32>(void)" (??$get_float_dtype@$0CA@@detail@numpy@python@boost@@YA?AVdtype@123@XZ) referenced in function "public: static class boost::python::numpy::dtype __cdecl boost::python::numpy::detail::builtin_dtype<float,0>::get(void)" (?get@?$builtin_dtype@M$0A@@detail@numpy@python@boost@@SA?AVdtype@345@XZ)
test\u boost\u python.obj:错误LNK2019:未解析的外部符号“class boost::python::numpy::dtype\uu cdecl boost::python::numpy::detail::get\u float\u dtype(void)”(?$get\u float\u dtype@$0CA@@detail@numpy@python@boost@@是吗?AVdtype@123@XZ)在函数中引用“公共:静态类boost::python::numpy::dtype\uu cdecl boost::python::numpy::detail::builtin\u dtype::get(void)”(?get@?$builtin)_dtype@M$0A@@detail@numpy@python@boost@@萨?AVdtype@345@XZ)

这个丢失符号的原因可能是什么?我应该如何修复它?

这是Boost::Python中的一个错误,请参阅问题
和提交。它已在Boost的最新开发分支中修复。我相信它将在1.65版中修复。

这是Boost::Python中的一个错误,请参阅问题 和提交。它已在Boost的最新开发分支中修复。我相信它将在1.65版中修复

test_boost_python.obj : error LNK2019: unresolved external symbol "class boost::python::numpy::dtype __cdecl boost::python::numpy::detail::get_float_dtype<32>(void)" (??$get_float_dtype@$0CA@@detail@numpy@python@boost@@YA?AVdtype@123@XZ) referenced in function "public: static class boost::python::numpy::dtype __cdecl boost::python::numpy::detail::builtin_dtype<float,0>::get(void)" (?get@?$builtin_dtype@M$0A@@detail@numpy@python@boost@@SA?AVdtype@345@XZ)