views:

342

answers:

1

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'
+1  A: 

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

Georg Fritzsche
http://ampaste.net/m3b514e46Thats what my includes look like, if I move #include <ZipArchive.h> above the other headers, I get #error : ("Must include tier0 type headers before tchar.h")I have tried about every combination of reorganizing the headers and I either get one or the other.
Brett Powell
I couldn't say which exact order is needed in your case without testing and i have neither the HL2SDK nor the zip-archive-thing installed. A hackish workaround you could try would be to surround the HL2 includes with `#define __AFXTLS_H__` and `#undef __AFXTLS_H__`. Another approach would be to simply not mix those headers - i.e. to implement a zip-stuff wrapper in a different source file.
Georg Fritzsche