[英]XDispatch C++ Unresolved Externals
我正在Windows 7的Visual Studio 2012中使用xdisptach,libdispatch在C ++中使用GCD。
我声明一个带有全局变量的类,该全局变量是调度队列。 该类中的其他函数调用队列的函数。 一切编译正常,除非我在构造函数中实例化队列。
xdispatch::queue* dispatch_queue;
AsyncNode()
{
dispatch_queue = new xdispatch::queue(Name);
}
当dispatch_queue = new xdispatch :: queue(Name); 被注释掉,一切编译正常。 否则我得到以下错误。
Error 50 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall xdispatch::queue::~queue(void)" (__imp_??1queue@xdispatch@@UAE@XZ) referenced in function "public: virtual void * __thiscall xdispatch::queue::`scalar deleting destructor'(unsigned int)" (??_Gqueue@xdispatch@@UAEPAXI@Z)
Error 49 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall xdispatch::queue::queue(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0queue@xdispatch@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: __thiscall AsyncNode::AsyncNode(void)" (??0AsyncNode@@QAE@XZ)
Error 53 error LNK2001: unresolved external symbol "public: virtual void __thiscall xdispatch::object::resume(void)" (?resume@object@xdispatch@@UAEXXZ)
Error 51 error LNK2001: unresolved external symbol "public: virtual void * __thiscall xdispatch::queue::native(void)const " (?native@queue@xdispatch@@UBEPAXXZ)
Error 52 error LNK2001: unresolved external symbol "public: virtual struct dispatch_queue_s * __thiscall xdispatch::queue::native_queue(void)const " (?native_queue@queue@xdispatch@@UBEPAUdispatch_queue_s@@XZ)
这是xdispatch的主要网站,但是我在论坛或xdispatch方面都找不到任何帮助。 有很多目标-....:/
http://opensource.mlba-team.de/xdispatch/docs/current/index.html
首先,有关删除“问题”行的行为是正常的-当您定义指针时,您没有调用任何函数,这就是您没有得到“未解决的外部错误”的原因。
当通过调用构造函数初始化变量时,您会遇到问题,因为您试图调用链接时不可用的函数。
使用DLL处理外部库时,必须链接到适当的导入库,通常以“ lib”文件的形式提供。 在您的情况下,zip包中有一个名为“ lib”的文件夹。 而且,DLL必须在运行时可用-通过将它们放在可执行文件的文件夹中,或者将它们添加到PATH环境变量中。
为了链接到库,请按照下列步骤操作(从MSDN中获取 ):
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.