我正在使用教程中的代码库来提供将非静态成员函数的函数点传递给需要静态函数指针的函数的功能,这可能有助于了解我在起诉什么,所以这里是链接http:/ /www.codeproject.com/KB/cpp/thunk32.aspx此代码使用 Boost 库,我已经下载并设置了或多或少的所有内容。
在 Thunk 库中,其中一个头文件有一段读取
#define BOOST_PP_ITERATION_PARAMS_1 (3,(0,THUNK32_MAX_ARGS,"Thunk32_template.h"))
??=include BOOST_PP_ITERATE()
#undef BOOST_PP_ITERATION_PARAMS_1
但这给了我大量的错误,我可以通过将其更改为来解决
#define BOOST_PP_ITERATION_PARAMS_1 (3,(0,THUNK32_MAX_ARGS,"Thunk32_template.h"))
#include BOOST_PP_ITERATE()
#undef BOOST_PP_ITERATION_PARAMS_1
下载的这段代码作为第二个项目包含在我的解决方案中,它能够愉快地编译和构建。但是我使用此代码的项目存在链接问题,为了避免人们询问,我收到这些错误消息
1>WebCamera.obj : error LNK2019: unresolved external symbol "protected: __thiscall indev::Thunk32Base::Thunk32Base(void)" (??0Thunk32Base@indev@@IAE@XZ) referenced in function "public: __thiscall indev::Thunk32<class WebCamera,void __cdecl(struct HWND__ *,struct videohdr_tag *)>::Thunk32<class WebCamera,void __cdecl(struct HWND__ *,struct videohdr_tag *)>(void)" (??0?$Thunk32@VWebCamera@@$$A6AXPAUHWND__@@PAUvideohdr_tag@@@Z@indev@@QAE@XZ)
1>WebCamera.obj : error LNK2019: unresolved external symbol "protected: __thiscall indev::Thunk32Base::~Thunk32Base(void)" (??1Thunk32Base@indev@@IAE@XZ) referenced in function "public: __thiscall indev::Thunk32<class WebCamera,void __cdecl(struct HWND__ *,struct videohdr_tag *)>::~Thunk32<class WebCamera,void __cdecl(struct HWND__ *,struct videohdr_tag *)>(void)" (??1?$Thunk32@VWebCamera@@$$A6AXPAUHWND__@@PAUvideohdr_tag@@@Z@indev@@QAE@XZ)
1>WebCamera.obj : error LNK2019: unresolved external symbol _capCreateCaptureWindowA@32 referenced in function "public: bool __thiscall WebCamera::Init(struct HWND__ *)" (?Init@WebCamera@@QAE_NPAUHWND__@@@Z)
我认为这是想说构造函数和析构函数没有声明,而且我的 WebCamera.Init() 也搞砸了。我已确保 Thunk32 项目导出的库包含在我的其他项目中,但我仍然收到这些错误。
我想知道我是否做出了??=include
应该更改为的正确假设,#include
如果有,我做错了什么或没有做错什么会导致这些链接器错误。或者,如果您可以为我提供一种能够将函数指针传递给非静态成员函数的不同方式,那就太棒了。
谢谢