我正在将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'
答案 0 :(得分:3)
C ++模板提示:
#ifndef __MY_CODE_eg #define __MY_CODE_eg // your code // here. #endif
答案 1 :(得分:2)
MS'ATL / MFC标头和HL2 SDK都包含类模板CThreadLocal
。
如果您按正确的顺序包含它们,即首先是ATL / MFC标头(或包含它们的标头),那么HL2 SDK标头,HL2 SDK应该通过#ifndef __AFXTLS_H__
处理该问题。