_WIN32_WINNT redefined?

i.nixman@autistici.org i.nixman@autistici.org
Wed Nov 2 15:51:05 GMT 2022


On 2022-11-02 15:18, Eli Zaretskii wrote:

> Then the stuff in common-defs.h should be augmented to define
> _WIN32_WINNT to the value 0x0600 or greater, if it isn't already high
> enough, but only if the patch for gthreads is being used.  How exactly
> to write the cpp conditional for that, I don't know, but hopefully you
> will be able to figure that out.

no.
just for eyes:
74 #if defined (__MINGW32__) || defined (__CYGWIN__)
75 # ifdef _WIN32_WINNT
76 #  if _WIN32_WINNT < 0x0501
77 #   undef _WIN32_WINNT
78 #   define _WIN32_WINNT 0x0501
79 #  endif
80 # else
81 #  define _WIN32_WINNT 0x0501
82 # endif
83 #endif  /* __MINGW32__ || __CYGWIN__ */

the condition on line 75 is always false, because none of the inclusions 
above include neither `windows.h` nor `winver.h`.
it can be solved by inclusion `windows.h` after line 74.
but I did it and faced with another error:
```
   CXX    gdb.o
   CXX    ada-exp.o
ada-exp.c.tmp:557: warning: "IN" redefined
In file included from 
C:/msys64/home/Sysuser/mingw-gcc-trunk/x86_64-trunk-win32-seh-rt_v10-rev0/mingw64/x86_64-w64-mingw32/include/windef.h:9,
                  from 
C:/msys64/home/Sysuser/mingw-gcc-trunk/x86_64-trunk-win32-seh-rt_v10-rev0/mingw64/x86_64-w64-mingw32/include/windows.h:69,
                  from 
../../../../src/gdb-11.2/gdb/../gdbsupport/common-defs.h:75,
                  from ../../../../src/gdb-11.2/gdb/defs.h:28,
                  from ada-exp.y:38:
C:/msys64/home/Sysuser/mingw-gcc-trunk/x86_64-trunk-win32-seh-rt_v10-rev0/mingw64/x86_64-w64-mingw32/include/minwindef.h:57: 
note: this is the location of the previous definition
    57 | #define IN
       |
ada-exp.c.tmp:482:11: error: 'INT' redeclared as different kind of 
entity
In file included from 
C:/msys64/home/Sysuser/mingw-gcc-trunk/x86_64-trunk-win32-seh-rt_v10-rev0/mingw64/x86_64-w64-mingw32/include/minwindef.h:163:
C:/msys64/home/Sysuser/mingw-gcc-trunk/x86_64-trunk-win32-seh-rt_v10-rev0/mingw64/x86_64-w64-mingw32/include/winnt.h:299:15: 
note: previous declaration 'typedef int INT'
   299 |   typedef int INT;
       |               ^~~
ada-exp.c.tmp:485:13: error: 'FLOAT' redeclared as different kind of 
entity
C:/msys64/home/Sysuser/mingw-gcc-trunk/x86_64-trunk-win32-seh-rt_v10-rev0/mingw64/x86_64-w64-mingw32/include/minwindef.h:142:17: 
note: previous declaration 'typedef float FLOAT'
   142 |   typedef float FLOAT;
       |                 ^~~~~
```

in that case I couldn't figure out why the `ada-exp.c.tmp` file is 
mentioned in the error message but I don't see anything that looks like 
an error in the `ada-exp.c` file.
I think `ada-exp.c.tmp` is some kind of generated file... I don't know 
what and how should I fix in that case %)


> Or maybe you should do that in gdbsupport/thread-pool.cc instead.
> Whatever is easier.

I will think on it...



> One thing is certain: GDB builds on Windows that don't use the gthread
> patch should not be broken by increasing the minimum value of
> _WIN32_WINNT with which GDB can be built on Windows.

I understand.



I have another option. will try and report back.





best!


More information about the Gdb mailing list