Thread: _WinMain@16

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    2

    Question _WinMain@16

    Dear All,

    I have recently migrated to Code::Blocks from Dev-cpp. When I tried several of my programs to compile, I always get:

    undefined reference to `_WinMain@16`

    message.

    I have searched through FAQs to find some hint, but no success! I have googled this message, but the MSN site was not very helpful(maybe I did not understand fully).

    It is probably something simple, but it does not help me. Please help.


    PS: My system is AMD 64 bit and Windows 64 bit Vista.

  2. #2
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    The message is a simple one. It means you did not defined a WinMain() function anywhere in your program.

    I'm assuming you have a main(), in which case you need to find the project option that'll compile a console app instead of a Windows app.
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    What compiler are you using?

    In gcc, it usually means that the second option of searching for main failed, so there is neither main, nor WinMain() [or WinMain is incorrectly declared].

    In Visual Studio, you are probably, as Cactus_hugger indicated, trying to build a program that has a main function, but with options to use WinMain function. This is fixed by changing your project options to compile as "Console" application rather than "Windows" (or GUI) application.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Registered User
    Join Date
    Jun 2009
    Posts
    2
    Thank you guys! I think I got good leads from you....

Popular pages Recent additions subscribe to a feed