Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7860781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:26:02+00:00 2026-06-02T22:26:02+00:00

/** converts ‘WinMain’ to the traditional ‘main’ entrypoint **/ #define PRO_MAIN(argc, argv)\ int __main

  • 0
/** converts 'WinMain' to the traditional 'main' entrypoint **/
#define PRO_MAIN(argc, argv)\
    int __main (int, LPWSTR*, HINSTANCE, int);\
    int WINAPI WinMain (HINSTANCE __hInstance, HINSTANCE __hPrevInstance, \
                       LPSTR __szCmdLine, int __nCmdShow)\
    {\
        int nArgs;\
        LPWSTR* szArgvW = CommandLineToArgvW (GetCommandLineW(), &nArgs);\
        assert (szArgvW != NULL);\
        return __main (nArgs, szArgvW, __hInstance, __nCmdShow);\
    }\
    \
    int __main (int __argc, LPWSTR* __argv, HINSTANCE __hInstance, int __nCmdShow)

Now, when I use this code here:

PRO_MAIN(argc, argv)
{
  ...
}

I get the error:

error: conflicting types for '__main'
note: previous declaration of '__main' was here

What’s the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T22:26:03+00:00Added an answer on June 2, 2026 at 10:26 pm

    You have broken the rules: double-underscores are reserved for implementation! (Among other things.)

    You simply cannot use __main, main__, _Main, etc. You should pick something else.

    I would recommend you make this work:

    int main(int argc, char* argv[])
    {
        // main like normal
    }
    
    // defines WinMain, eventually makes call to main()
    PRO_MAIN;
    

    Which has the added advantage that for non-Windows applications, PRO_MAIN can simply expand to nothing, and the program still compiles with the standard main function. This is what I do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code to converts an IP to an int in a very fast
I'm looking for a function where converts a string to a nullable int. But
Is there a function in haskell which converts from int to float, and from
the operator int() function converts the string to an int class mystring { private:
JavaScript converts integers with more than 21 digits to scientific notation when used in
I know Jython converts Python code into Java byte code, but are there any
The following code converts a PDF page into a JPEG. It runs as expected
so the following converts big endians to little ones uint32_t ntoh32(uint32_t v) { return
I have an Html Helper that converts an Enum into a SelectList like so:
Is there a built-in function that converts a datetime.date object into a datetime.datetime object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.