gpt4 book ai didi

c++ - 无法在 Boost.Python 中使用 __stdcall 编译示例

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:24:38 24 4
gpt4 key购买 nike

我正在尝试使用 Boost.Python 在 Python 中包装一个函数,但在使用 __stdcall 时我遇到了问题。这是一个例子:

#define BOOST_PYTHON_STATIC_LIB
#define BOOST_PYTHON_ENABLE_STDCALL
#include <boost/python.hpp>
#include <boost/python/signature.hpp>

void __stdcall f(void)
{
return;
}

using namespace boost::python;

BOOST_PYTHON_MODULE(MyPyDLL)
{
def("func", f);
}

当我尝试编译时,我遇到了 100 多个类似的错误,但前两个是:

error C2780: 'boost::mpl::vector10::type&,T0,T1,T2,T3,T4,T5,T6,T7> boost::python::detail::get_signature(RT (__thiscall ClassT::* )(T0,T1,T2,T3,T4,T5,T6,T7) const,Target *)': expects 2 arguments - 1 provided C:\boost\boost_1_62_0_python\boost\python\make_function.hpp 104

error C2780: 'boost::mpl::vector10::type&,T0,T1,T2,T3,T4,T5,T6,T7> boost::python::detail::get_signature(RT (__thiscall ClassT::* )(T0,T1,T2,T3,T4,T5,T6,T7) volatile const,Target *)': expects 2 arguments - 1 provided C:\boost\boost_1_62_0_python\boost\python\make_function.hpp 104

如您所见,我使用了定义 BOOST_PYTHON_ENABLE_STDCALL ,这在 this page: 中有提及。

但无论是否定义它,问题都一样。

有谁知道我做错了什么吗?

最佳答案

如果在导入 boost 头文件后定义 BOOST_PYTHON_ENABLE_STDCALL,则会出现该错误。

关于c++ - 无法在 Boost.Python 中使用 __stdcall 编译示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40780661/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com