Thread: Is this necessary: int APIENTRY WinMain

  1. #1

    Is this necessary: int APIENTRY WinMain

    When I created my Win32 Application workspace, there was already a .cpp file created (Visual Studio 6) which had this function already in it:

    int APIENTRY WinMain(HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow)


    Everything I've read uses:

    int main(<arguments>)


    When I removed the WinMain declaration and used int main, I got an "Invalid entrypoint" error during compile.

    I looked under:


    and saw a field titled: Entry-point symbol which had WinMain in it. I replaced it with main and it still gave me errors...

    Could someone give me some steps to setting up an empty workspace? I seem to get different settings every time I create a new Win32 Application. I really have no idea what all the different options do under Project>Settings....

    Perhaps someone could recommend a book geared towards the Visual Studio compiler... doesn't have to be an advanced book, I'm still learning the basics.


  2. #2
    Registered User
    Join Date
    Sep 2001
    Two reccomendations:

    1) Learn to love DJGPP w/ RHIDE
    2) When you create a new project, create a Windows CONSOLE application. Regular windows applications need the WinMain nonsense.
    Callou collei we'll code the way
    Of prime numbers and pings!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can some one please tell me the cause of the error ?
    By broli86 in forum C Programming
    Replies: 8
    Last Post: 06-26-2008, 08:36 PM
  2. Replies: 8
    Last Post: 03-10-2008, 11:57 AM
  3. Replies: 3
    Last Post: 05-13-2007, 08:55 AM
  4. Working with random like dice
    By SebastionV3 in forum C++ Programming
    Replies: 10
    Last Post: 05-26-2006, 09:16 PM
  5. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM