Warning C28251: Inconsistent annotation for 'WinMain'

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
fishnet37222
Experienced Solver
Experienced Solver
Posts: 74
Joined: Sat May 06, 2017 1:40 pm

Warning C28251: Inconsistent annotation for 'WinMain'

Post by fishnet37222 »

I am creating a project using Visual Studio 2019 on Windows 10 with wxWidgets 3.1.2. When I use wxIMPLEMENT_APP(), I get a warning and a green squiggle under the name of the macro. The code compiles and runs fine, but that squiggle is distracting. If I knew what needed to be changed in the wxWidgets code, I would fix it myself. The full warning text I'm getting is below.

Warning C28251, Inconsistent annotation for 'WinMain': this instance has no annotations. See c:\program files (x86)\windows kits\10\include\10.0.18362.0\um\winbase.h(933).
Dave F.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Warning C28251: Inconsistent annotation for 'WinMain'

Post by doublemax »

As VS2019 is newer than wx3.1.2, could you please check if you get the same warning with the latest wx version from Github?
Use the source, Luke!
fishnet37222
Experienced Solver
Experienced Solver
Posts: 74
Joined: Sat May 06, 2017 1:40 pm

Re: Warning C28251: Inconsistent annotation for 'WinMain'

Post by fishnet37222 »

I just tried using the version from GitHub and got the same warning.
Dave F.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Warning C28251: Inconsistent annotation for 'WinMain'

Post by doublemax »

I have no VS2019 installed to test this right now and i also don't know if it's worth opening a bug report. But if you want, please do so at http://trac.wxwidgets.org/
Use the source, Luke!
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Warning C28251: Inconsistent annotation for 'WinMain'

Post by PB »

I see the warning (it is IntelliSense warning, not a build one) as well.

If you google the warning , you will find what causes and how to fix it. I will report it, we will see if it is a worthy a fix (MSVC-specific WinMain?) or just a warning suppression.

JFYI, building this simple application

Code: Select all

#include <wx/wx.h>

class MyApp : public wxApp
{
public:
    bool OnInit() override
    {
        (new wxFrame(nullptr, wxID_ANY, "Test"))->Show();
        return true;
    }
}; wxIMPLEMENT_APP(MyApp);
gives 121 wxWidgets IntelliSense warnings. The only difference from the one in the OP is there are no underlines visible in the user code for 120 of those. Most of the warnings is about unscoped enum, the rest are mostly false positives...

EDIT
I have created the ticket: https://trac.wxwidgets.org/ticket/18529
Post Reply