Page 1 of 1

Warning C28251: Inconsistent annotation for 'WinMain'

Posted: Sat Oct 12, 2019 6:46 pm
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).

Re: Warning C28251: Inconsistent annotation for 'WinMain'

Posted: Sat Oct 12, 2019 7:21 pm
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?

Re: Warning C28251: Inconsistent annotation for 'WinMain'

Posted: Sat Oct 12, 2019 7:52 pm
by fishnet37222
I just tried using the version from GitHub and got the same warning.

Re: Warning C28251: Inconsistent annotation for 'WinMain'

Posted: Sat Oct 12, 2019 10:36 pm
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/

Re: Warning C28251: Inconsistent annotation for 'WinMain'

Posted: Sun Oct 13, 2019 9:53 am
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