Re: _WIN32_WINNT redefined?

Jeffrey Walton via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAH8yC8mFh8Kde9OGd-uGCv5EDDRw+SnR+pHzm41dPW-Zpc8HrA@mail.gmail.com>
On Wed, Nov 2, 2022 at 9:02 AM Eli Zaretskii via Gdb <[email protected]> wrote:
>
> > Date: Wed, 02 Nov 2022 10:15:01 +0000
> > X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00, DKIM_SIGNED,
> >  DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_PASS, SPF_PASS,
> >  TXREP autolearn=ham autolearn_force=no version=3.4.6
> > From: niXman via Gdb <[email protected]>
> >
> > On 2022-11-02 09:46, niXman via Gdb wrote:
> > > On 2022-11-02 08:44, niXman via Gdb wrote:
> > >> On 2022-11-02 08:21, niXman via Gdb wrote:
> > >
> > > ok, I did a little research.
> > >
> > > the `_WIN32_WINNT` is defined in `gdbsupport/common-defs.h` only, but
> > > referenced in `gnulib/import/gettimeofdeay.c` and
> > > `gnulib/import/stat-w32.c` only, but not directly because those files
> > > include `windows,h` and `sdkdkver.h`. thus that `_WIN32_WINNT` define
> > > is never used!
> > >
> > > so I think the best way is to remove that define completely.
> > >
> > >
> > > ideas?
> >
> > right, with commented out the entire PP block the build was successful!
>
> This is the wrong solution, IMO.

Here's what Microsoft has to say about it:
https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt
"

    To modify the macros, in a header file (for example, in targetver.h,
    which is included by some project templates that target Windows),
    add the following lines.

    #define WINVER 0x0A00
    #define _WIN32_WINNT 0x0A00

If I am reading that correctly, there should be a common header file
which defines WINVER and _WIN32_WINNT. In my old MFC days, we would
set it in a file like <stdafx.h> . In a non-MFC project, we would set
it under the Visual Studio preprocessor macros, which is just
CPPFLAGS.

Maybe there needs to be a configure option to set the values.
Configure would then create the header file with the values. If the
configure option is not supplied, then use a sane default value and
create the header file.

Jeff
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.