如何修复已定义的类模板?
我正在将 ZipArchive 库实现到我的项目中,我与它斗争了一个多小时,使其正确设置以阻止所有链接器错误。但现在我仍然剩下这个问题,我不确定修复它的最佳方法,需要一些帮助。
C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxtls_.h(199) : error C2953: 'CThreadLocal' : class template has already been defined
c:\dev-mms\hl2sdk-ob-valve\public\tier0/threadtools.h(283) : see declaration of 'CThreadLocal'
C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxtls_.h(202) : warning C4005: 'THREAD_LOCAL' : macro redefinition
c:\dev-mms\hl2sdk-ob-valve\public\tier0/threadtools.h(71) : see previous definition of 'THREAD_LOCAL'
I am implementing ZipArchive library into my project, and I fought with it for over an hour getting it setup right to stop all the linker errors. But now I still have this left over and I am not sure of the best approach to fix it, could use some help.
C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxtls_.h(199) : error C2953: 'CThreadLocal' : class template has already been defined
c:\dev-mms\hl2sdk-ob-valve\public\tier0/threadtools.h(283) : see declaration of 'CThreadLocal'
C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxtls_.h(202) : warning C4005: 'THREAD_LOCAL' : macro redefinition
c:\dev-mms\hl2sdk-ob-valve\public\tier0/threadtools.h(71) : see previous definition of 'THREAD_LOCAL'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
C++ 模板提示:
C++ Templates hints:
MS 的 ATL/MFC 标头和 HL2 SDK 都包含类模板
CThreadLocal
。如果您按照正确的顺序包含这些标头,即首先包含 ATL/MFC 标头(或包含它们的标头),然后包含 HL2 SDK 标头,则 HL2 SDK 应该通过
#ifndef __AFXTLS_H__
。Both MS' ATL/MFC headers and the HL2 SDK contain a class template
CThreadLocal
.If you'd include those in the right order, i.e. ATL/MFC headers first (or the headers which include them), then the HL2 SDK headers, the HL2 SDK should handle that problem via an
#ifndef __AFXTLS_H__
.