2016-11-24 32 views
4

我試圖用Boost.Python在Python中包裝函數,並且在使用__stdcall時遇到問題。這裏有一個例子:無法在Boost.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個類似的錯誤,但第2:

錯誤C2780: 「的boost :: MPL :: vector10 :: (T0,T1,T2,T3,T4,T0,T1,T2,T3,T4,T5,T6,T7> ,T5,T6,T7)const,Target *)':期望2個參數 - 1 提供 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 *)':expected 2 arguments - 1 provided C:\ boost \ boost_1_62_0_python \ boost \ python \ make_function.hpp 104

正如你所看到的,我用的定義BOOST_PYTHON_ENABLE_STDCALL,這是在this page:

提及,但問題停留在S有無定義它。

有誰知道我做錯了什麼?

回答

-1

如果您在導入boost頭文件後定義了BOOST_PYTHON_ENABLE_STDCALL,將會出現該錯誤。