Macros redefinition

44 views
Skip to first unread message

Rossano Paris

unread,
Apr 18, 2026, 9:01:34 AM (9 days ago) Apr 18
to wx-users
Hi,
Does anyone know how to get rid of the following warnings?
Are they something that should be solved in the library?

Visual studio 2026
MSW SDK:10.0.26100.0
wx: v3.3.2

1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\urlmon.h(751,9): warning C4005: 'INET_E_CANNOT_LOCK_REQUEST': macro redefinition
1>  (compiling source file 'file:///sln/client/threads/core/ThClientInformation.cpp')
1>      \\192.168.84.1\workspace\develop\wxw\wx\wxWidgets-3.3.3\include\wx\msw\missing.h(360,9):
1>      see previous definition of 'INET_E_CANNOT_LOCK_REQUEST'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\urlmon.h(752,9): warning C4005: 'INET_E_USE_EXTEND_BINDING': macro redefinition
1>  (compiling source file 'file:///sln/client/threads/core/ThClientInformation.cpp')
1>      \\192.168.84.1\workspace\develop\wxw\wx\wxWidgets-3.3.3\include\wx\msw\missing.h(364,9):
1>      see previous definition of 'INET_E_USE_EXTEND_BINDING'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\urlmon.h(753,9): warning C4005: 'INET_E_TERMINATED_BIND': macro redefinition
1>  (compiling source file 'file:///sln/client/threads/core/ThClientInformation.cpp')
1>      \\192.168.84.1\workspace\develop\wxw\wx\wxWidgets-3.3.3\include\wx\msw\missing.h(368,9):
1>      see previous definition of 'INET_E_TERMINATED_BIND'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\urlmon.h(763,9): warning C4005: 'INET_E_ERROR_FIRST': macro redefinition
1>  (compiling source file 'file:///sln/client/threads/core/ThClientInformation.cpp')
1>      \\192.168.84.1\workspace\develop\wxw\wx\wxWidgets-3.3.3\include\wx\msw\missing.h(284,9):
1>      see previous definition of 'INET_E_ERROR_FIRST'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\urlmon.h(764,9): warning C4005: 'INET_E_CODE_DOWNLOAD_DECLINED': macro redefinition
1>  (compiling source file 'file:///sln/client/threads/core/ThClientInformation.cpp')
1>      \\192.168.84.1\workspace\develop\wxw\wx\wxWidgets-3.3.3\include\wx\msw\missing.h(376,9):
1>      see previous definition of 'INET_E_CODE_DOWNLOAD_DECLINED'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\urlmon.h(765,9): warning C4005: 'INET_E_RESULT_DISPATCHED': macro redefinition
1>  (compiling source file 'file:///sln/client/threads/core/ThClientInformation.cpp')
1>      \\192.168.84.1\workspace\develop\wxw\wx\wxWidgets-3.3.3\include\wx\msw\missing.h(380,9):
1>      see previous definition of 'INET_E_RESULT_DISPATCHED'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\urlmon.h(766,9): warning C4005: 'INET_E_CANNOT_REPLACE_SFP_FILE': macro redefinition
1>  (compiling source file 'file:///sln/client/threads/core/ThClientInformation.cpp')
1>      \\192.168.84.1\workspace\develop\wxw\wx\wxWidgets-3.3.3\include\wx\msw\missing.h(384,9):
1>      see previous definition of 'INET_E_CANNOT_REPLACE_SFP_FILE'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\urlmon.h(768,9): warning C4005: 'INET_E_CODE_INSTALL_SUPPRESSED': macro redefinition
1>  (compiling source file 'file:///sln/client/threads/core/ThClientInformation.cpp')
1>      \\192.168.84.1\workspace\develop\wxw\wx\wxWidgets-3.3.3\include\wx\msw\missing.h(392,9):
1>      see previous definition of 'INET_E_CODE_INSTALL_SUPPRESSED'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\urlmon.h(770,9): warning C4005: 'INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY': macro redefinition
1>  (compiling source file 'file:///sln/client/threads/core/ThClientInformation.cpp')
1>      \\192.168.84.1\workspace\develop\wxw\wx\wxWidgets-3.3.3\include\wx\msw\missing.h(388,9):
1>      see previous definition of 'INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\urlmon.h(7134,9): warning C4005: 'INET_E_QUERYOPTION_UNKNOWN': macro redefinition
1>  (compiling source file 'file:///sln/client/threads/core/ThClientInformation.cpp')
1>      \\192.168.84.1\workspace\develop\wxw\wx\wxWidgets-3.3.3\include\wx\msw\missing.h(348,9):
1>      see previous definition of 'INET_E_QUERYOPTION_UNKNOWN'

Vadim Zeitlin

unread,
Apr 18, 2026, 9:07:10 AM (9 days ago) Apr 18
to wx-u...@googlegroups.com
On Sat, 18 Apr 2026 06:01:33 -0700 (PDT) Rossano Paris wrote:

RP> Does anyone know how to get rid of the following warnings?
RP> Are they something that should be solved in the library?
RP>
RP> Visual studio 2026
RP> MSW SDK:10.0.26100.0
RP> wx: v3.3.2
RP>
RP> 1>C:\Program Files (x86)\Windows
RP> Kits\10\Include\10.0.26100.0\um\urlmon.h(751,9): warning C4005:
RP> 'INET_E_CANNOT_LOCK_REQUEST': macro redefinition
RP> 1> (compiling source file
RP> 'file:///sln/client/threads/core/ThClientInformation.cpp')
RP> 1>
RP> \\192.168.84.1\workspace\develop\wxw\wx\wxWidgets-3.3.3\include\wx\msw\missing.h(360,9):
RP> 1> see previous definition of 'INET_E_CANNOT_LOCK_REQUEST'

This is strange because wx/msw/missing.h only defines this symbol (and all
the other ones) if it's not defined after including windows.h.

What headers exactly does your source file include and in what order?

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
https://www.tt-solutions.com/

Paris Rossano

unread,
Apr 18, 2026, 9:21:55 AM (9 days ago) Apr 18
to wx-u...@googlegroups.com, Vadim Zeitlin
in all my .cpp files I normally use this sequence:

#include <wx/wxprec.h>

#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif

then follow wx includes,for instance:
#include <wx/filedlg.h>
#include <wx/filename.h>

then follow my application includes
...

Regards
Rossano

Vadim Zeitlin

unread,
Apr 18, 2026, 9:28:54 AM (9 days ago) Apr 18
to wx-u...@googlegroups.com
On Sat, 18 Apr 2026 15:21:48 +0200 Paris Rossano wrote:

PR> in all my .cpp files I normally use this sequence:
PR>
PR> #include <wx/wxprec.h>
PR>
PR> #ifndef WX_PRECOMP
PR> #include <wx/wx.h>
PR> #endif
PR>
PR> then follow wx includes,for instance:
PR> #include <wx/filedlg.h>
PR> #include <wx/filename.h>
PR>
PR> then follow my application includes

This is perfectly standard and I don't see any such warnings when doing
this with MSVS 2022. Either this has somehow changed in MSVS 2026 (I don't
have it yet, so can't test myself) or, more likely, there is something I'm
missing here.

Do you get the same warnings when building minimal sample?

Paris Rossano

unread,
Apr 18, 2026, 9:53:32 AM (9 days ago) Apr 18
to wx-u...@googlegroups.com, Vadim Zeitlin
building minimal sample I don't see any warning ...

Vadim Zeitlin

unread,
Apr 18, 2026, 11:11:28 AM (9 days ago) Apr 18
to wx-u...@googlegroups.com
On Sat, 18 Apr 2026 15:53:24 +0200 Paris Rossano wrote:

PR> building minimal sample I don't see any warning ...

So there must be some difference, either in the code or in the compilation
settings, between it and your application. Please try to find what it is
because I don't see it (but it's a bit more difficult for me, at least you
have access to your code and could use /showIncludes to see which headers
are included by it and in which order).

Thanks,

Paris Rossano

unread,
Apr 18, 2026, 12:33:34 PM (9 days ago) Apr 18
to wx-u...@googlegroups.com, Vadim Zeitlin
thank you for the tip, I will follow your suggestion ...

Paris Rossano

unread,
Apr 20, 2026, 2:30:46 AM (7 days ago) Apr 20
to wx-u...@googlegroups.com, Vadim Zeitlin
I searched for my issue, and it was due to |WIN32_LEAN_AND_MEAN|, which was
silently lying in my project's preprocessor definitions since I added
|wxWebView| to my application.
I simply removed |WIN32_LEAN_AND_MEAN|, which is no longer needed.

Thanks
Rossano

On 18/04/2026 17:11, Vadim Zeitlin wrote:

Vadim Zeitlin

unread,
Apr 20, 2026, 5:11:34 PM (6 days ago) Apr 20
to wx-u...@googlegroups.com
On Mon, 20 Apr 2026 08:30:38 +0200 Paris Rossano wrote:

PR> I searched for my issue, and it was due to |WIN32_LEAN_AND_MEAN|, which was
PR> silently lying in my project's preprocessor definitions since I added
PR> |wxWebView| to my application.
PR> I simply removed |WIN32_LEAN_AND_MEAN|, which is no longer needed.

I see, defining WIN32_LEAN_AND_MEAN means that lesser used headers are not
included by windows.h, which results in these symbols not being defined
after its inclusion, but being defined later when the header defining them
is included directly.

I think we can avoid this problem by moving the definitions of "missing"
(not really in this case) from wx/msw/missing.h to webview_missing.h, as I
just did in https://github.com/wxWidgets/wxWidgets/pull/26400 which, I
think, should avoid the issue even if you restore WIN32_LEAN_AND_MEAN.

Thanks for finding the underlying reason for this problem,
Reply all
Reply to author
Forward
0 new messages