如何修复已经定义的类模板? [英] How do I fix class template has already been defined?

查看:192
本文介绍了如何修复已经定义的类模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将ZipArchive库实现到我的项目中,并且为此奋斗了一个多小时,以使其正确设置以停止所有链接器错误。但是现在我仍然有这个问题,我不确定最好的解决方法,可以使用一些帮助。

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'


推荐答案

MS的ATL / MFC标头和HL2 SDK都包含一个类模板 CThreadLocal

Both MS' ATL/MFC headers and the HL2 SDK contain a class template CThreadLocal.

如果要以正确的顺序包含它们,即首先包含ATL / MFC标头(或包含它们的标头),然后是HL2 SDK标头,则是HL2 SDK应该通过 #ifndef __AFXTLS_H __ 处理该问题。

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__.

这篇关于如何修复已经定义的类模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆