On 01/10/2013 05:20 PM, Angelo Graziosi wrote: > Trying to compile a C++ source file including windows.h header with > clang++, fails with > > #error Must define a target architecture I have hit this too with log4cplus. This is my workaround:
// Work around missing _X86_ symbol with Clang on Cygwin.
#if ! defined (_X86_) && defined (__i386__)
# define _X86_ 1
#endif
#include <windows.h>
>
>
> For example,
>
> $ cat foo.cxx
> #include <windows.h>
>
> int main()
> {
> return 0;
> }
>
> $ clang++ -c foo.cxx -o foo.o
> In file included from foo.cxx:1:
> In file included from /usr/include/w32api/windows.h:69:
> In file included from /usr/include/w32api/windef.h:139:
> /usr/include/w32api/winnt.h:375:2: error: Must define a target
> architecture.
> #error Must define a target architecture.
> ^
> /usr/include/w32api/winnt.h:2410:7: error: unknown type name 'PCONTEXT';
> did you
> mean '_CONTEXT'?
> PCONTEXT ContextRecord;
> ^
> /usr/include/w32api/excpt.h:84:96: note: '_CONTEXT' declared here
> ..._EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
> ^
> In file included from foo.cxx:1:
> In file included from /usr/include/w32api/windows.h:69:
> In file included from /usr/include/w32api/windef.h:139:
> /usr/include/w32api/winnt.h:2410:16: error: field has incomplete type
> '_CONTEXT'
> PCONTEXT ContextRecord;
> ^
> /usr/include/w32api/excpt.h:84:96: note: forward declaration of '_CONTEXT'
> ..._EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
> ^
> In file included from foo.cxx:1:
> In file included from /usr/include/w32api/windows.h:69:
> In file included from /usr/include/w32api/windef.h:139:
> /usr/include/w32api/winnt.h:5668:25: error: variable has incomplete type
> 'void'
> NTSYSAPI VOID NTAPI RtlCaptureContext(PCONTEXT ContextRecord);
> ^
> /usr/include/w32api/winnt.h:5668:43: error: use of undeclared identifier
> 'PCONTEXT'
> NTSYSAPI VOID NTAPI RtlCaptureContext(PCONTEXT ContextRecord);
> ^
> In file included from foo.cxx:1:
> In file included from /usr/include/w32api/windows.h:70:
> /usr/include/w32api/winbase.h:611:11: error: unknown type name
> 'PCONTEXT'; did
> you mean '_CONTEXT'?
> typedef PCONTEXT LPCONTEXT;
> ^
> /usr/include/w32api/excpt.h:84:96: note: '_CONTEXT' declared here
> ..._EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
> ^
> In file included from foo.cxx:1:
> In file included from /usr/include/w32api/windows.h:70:
> /usr/include/w32api/winbase.h:1375:67: error: unknown type name
> 'CONTEXT'; did
> you mean '_CONTEXT'?
> ...WINAPI SetThreadContext(HANDLE hThread,CONST CONTEXT *lpContext);
> ^
> /usr/include/w32api/excpt.h:84:96: note: '_CONTEXT' declared here
> ..._EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
> ^
> 7 errors generated.
>
>
> Really I have seen this the first time trying to build the next release
> of ROOT (i.e. source from svn; the main page for ROOT is :
> http://root.cern.ch).
>
> Indeed now ROOT uses clang tools to build (GCC is used to bootstrap
> ROOT's patched version of CLANG...). Nevertheless the same errors occurs
> using Cygwin's CLANG as the above simple test case shows...
--
VZ
signature.asc
Description: OpenPGP digital signature

