简体   繁体   English

boost.numpy 函数抛出未解决的外部符号链接错误

[英]boost.numpy functions are throwing unresolved extern symbol link errors

I'm using normal Boost.NumPy functions in C++ like ndarray::get_data(), and I get a "reference to unresolved external symbol" error.我在 C++ 中使用普通的 Boost.NumPy 函数,如 ndarray::get_data(),我得到一个“对未解析外部符号的引用”错误。 The.lib's are linked and I have no approach on how to solve the error. .lib 是链接的,我没有解决该错误的方法。

I am using Boost 1.74.我正在使用 Boost 1.74。

Here is a Code example:这是一个代码示例:

#include<boost/python/numpy.hpp>
using namespace boost;

void func(python::object _obj)
{
    python::numpy::ndarray my_ndarray = python::extract<boost::python::numpy::ndarray>(_obj.attr("Member_01"));

    char* data = my_ndarray.get_data();
}

BOOST_PYTHON_MODULE(ogwa_acc) 
{     
    python::def("func", func);
} 

Thats the one of the unresolved symbols: ""__declspec(dllimport) public: char * __cdecl boost::python::numpy::ndarray::get_data(void)const " (_imp?get_data@ndarray@numpy@python@boost@@QEBAPEADXZ)"那是未解析的符号之一: ""__declspec(dllimport) public: char * __cdecl boost::python::numpy::ndarray::get_data(void)const " (_imp?get_data@ndarray@numpy@python@boost@@QEBAPEADXZ)"

I am using the normal Visual Studio linker and this is my linker config:我使用的是普通的 Visual Studio linker,这是我的 linker 配置:

/OUT:"D:\OthelloGame_withAI\x64\Debug\ogwa_acc.pyd" /MANIFEST /NXCOMPAT 
/PDB:"D:\OthelloGame_withAI\x64\Debug\ogwa_acc.pdb" /DYNAMICBASE 
"boost_numpy38-vc142-mt-gd-x64-1_74.lib" "boost_numpy38-vc142-mt-x64-1_74.lib" 
"boost_python38-vc142-mt-gd-x64-1_74.lib" "boost_python38-vc142-mt-x64- 
1_74.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" 
"advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" 
"odbccp32.lib" /IMPLIB:"D:\OthelloGame_withAI\x64\Debug\ogwa_acc.lib" /DEBUG 
/DLL /MACHINE:X64 /INCREMENTAL 
/PGD:"D:\OthelloGame_withAI\x64\Debug\ogwa_acc.pgd" /SUBSYSTEM:CONSOLE 
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" 
/ManifestFile:"x64\Debug\ogwa_acc.pyd.intermediate.manifest" 
/ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"C:\Program Files\Python38\libs" 
/LIBPATH:"D:\OthelloGame_withAI\Third-Party\boost_1_74_0\finished_libs" /TLBID:1

D:\OthelloGame_withAI\Third-Party\boost_1_74_0\finished_libs is the location of: D:\OthelloGame_withAI\Third-Party\boost_1_74_0\finished_libs是以下位置:

boost_numpy38-vc142-mt-gd-x64-1_74.lib; boost_python38-vc142-mt-gd-x64- 
1_74.lib; boost_numpy38-vc142-mt-x64-1_74.lib;
boost_python38-vc142-mt-x64-1_74.lib

You may have more luck asking here: https://github.com/boostorg/python/issues你可能有更多的运气在这里问: https://github.com/boostorg/python/issues

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM