| www.delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_PGP_SIGNED,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE |
| X-Spam-Check-By: | sourceware.org |
| X-Received: | by 10.152.131.137 with SMTP id om9mr68601385lab.18.1357838178530; Thu, 10 Jan 2013 09:16:18 -0800 (PST) |
| Message-ID: | <50EEF75E.1040106@gmail.com> |
| Date: | Thu, 10 Jan 2013 18:16:14 +0100 |
| From: | =?UTF-8?B?VsOhY2xhdiBaZW1hbg==?= <vhaisman AT gmail DOT com> |
| User-Agent: | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 |
| MIME-Version: | 1.0 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Clang and windows headers |
| References: | <50EEEA49 DOT 1050507 AT alice DOT it> |
| In-Reply-To: | <50EEEA49.1050507@alice.it> |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
--------------enig43DA939B63F99DD87900C8F3
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
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
>=20
> #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>
>=20
>=20
> For example,
>=20
> $ cat foo.cxx
> #include <windows.h>
>=20
> int main()
> {
> return 0;
> }
>=20
> $ 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.
>=20
>=20
> 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).
>=20
> 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
--------------enig43DA939B63F99DD87900C8F3
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/
iF4EAREIAAYFAlDu918ACgkQ6OWUyaYNY6Pe3AD8DnRJpi9ov4gtEaVTZVz03i5y
RsoPlysCyQwVcemG3qoA/ArqYR1+Q+n9xcVclkQxMv3Wj/Nzf4DtwtG2A1xBj0lj
=ou6d
-----END PGP SIGNATURE-----
--------------enig43DA939B63F99DD87900C8F3--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |