[cfe-dev] Try again - Compiler error including windows.h

Edward Diener via cfe-dev cfe-dev at lists.llvm.org
Wed May 10 15:19:04 PDT 2017


Compiling:

#include <windows.h>
int main()
{return 0;}

with clang built from source on Windows targeting mingw-64/gcc-7.1 as 
the backend, with the command line:

"some_path/clang++" -c -x c++ -Wno-dll-attribute-on-redeclaration -O0 -g 
-fno-inline -Wall -g -target i686-pc-windows-gnu -march=i686 -m32 -o 
"some_object_path/test_compiler.obj" "some_source_path/test_compiler.cpp"

outputs:

In file included from test_compiler.cpp:2:
In file included from 
C:\Utilities\mingw-w64\i686-7.1.0-posix-dwarf-rt_v5-rev0\mingw32\i686-w64-mingw32\include\windows.h:69:
In file included from 
C:\Utilities\mingw-w64\i686-7.1.0-posix-dwarf-rt_v5-rev0\mingw32\i686-w64-mingw32\include\windef.h:8:
In file included from 
C:\Utilities\mingw-w64\i686-7.1.0-posix-dwarf-rt_v5-rev0\mingw32\i686-w64-mingw32\include\minwindef.h:163:
C:\Utilities\mingw-w64\i686-7.1.0-posix-dwarf-rt_v5-rev0\mingw32\i686-w64-mingw32\include\winnt.h:4720:18: 
error: default initialization of an object of const type 'const GUID' 
(aka 'const _GUID') without a user-provided default constructor
     DEFINE_GUID (GUID_MAX_POWER_SAVINGS, 0xa1841308, 0x3541, 0x4fab, 
0xbc, 0x81, 0xf7, 0x15, 0x56, 0xf2, 0x0b, 0x4a);
                  ^
C:\Utilities\mingw-w64\i686-7.1.0-posix-dwarf-rt_v5-rev0\mingw32\i686-w64-mingw32\include\winnt.h:4721:18: 
error: default initialization of an object of const type 'const GUID' 
(aka 'const _GUID') without a user-provided default constructor
     DEFINE_GUID (GUID_MIN_POWER_SAVINGS, 0x8c5e7fda, 0xe8bf, 0x4a96, 
0x9a, 0x85, 0xa6, 0xe2, 0x3a, 0x8c, 0x63, 0x5c);
                  ^
C:\Utilities\mingw-w64\i686-7.1.0-posix-dwarf-rt_v5-rev0\mingw32\i686-w64-mingw32\include\winnt.h:4722:18: 
error: default initialization of an object of const type 'const GUID' 
(aka 'const _GUID') without a user-provided default constructor
     DEFINE_GUID (GUID_TYPICAL_POWER_SAVINGS, 0x381b4222, 0xf694, 
0x41f0, 0x96, 0x85, 0xff, 0x5b, 0xb2, 0x60, 0xdf, 0x2e);
                  ^
etc. etc. for the rest of the DEFINE_GUIDs in mingw-64/gcc-7.1 winnt.h

This error does not occur using the clang-4.0 distribution and 
mingw-64/gcc-7.1 as the backend.

Should I:

1) Report this to a bug tracker ?

or

2) Ignore it and just assume that trying using clang from source on 
Windows targeting gcc is a waste of time since it has low/no priority 
among clang programming tasks ?

or

3) Be thankful that the clang-4.0 release works as well as it does and 
use only official releases and not bother building clang from source for 
use on Windows from now on ?

OK, it is a rhetorical question, but I have gotten to the point where 
trying to build from source and use it, on Windows, is a losing 
proposition and waiting for the next official release and assume that 
problems will be fixed by that time is the way to go.









More information about the cfe-dev mailing list