Thread: WinMain? main?

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    7

    Question WinMain? main?

    hi,
    i tried to use WinMain instead of main in my program but an error on linking. the error message shown below:

    Linking...
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/DialogBox.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    please advice. thanks



    thanatos

  2. #2
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    Do you have your callback?

  3. #3
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    show some code then it will be easier to help

  4. #4
    Registered User
    Join Date
    May 2002
    Posts
    7

    code

    hi

    here is the code of WinMain

    int PASCAL WinMain(HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nShowCmd)
    {
    memset(&globe,0,sizeof(globe));
    globe.winapp=hInstance;

    if(CreateTheDialogBox()<0) {
    return -1;
    }
    return 0;
    }

    besides, i don't understand what is "callback". i'm new in C. :(
    thanks


    thanatos

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Look at what type of app you are creating.

    Looks like you have not created a WIN32 app, so it is looking for the usual main().
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  6. #6
    Registered User
    Join Date
    May 2002
    Posts
    7
    i got you novacain. i created a win32 console application instead of win32 application.
    thanks everybody.

    thanatos

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. confused about adding controls to main window
    By terracota in forum Windows Programming
    Replies: 4
    Last Post: 11-24-2004, 12:35 PM
  2. Return Statement
    By Daveo in forum C Programming
    Replies: 21
    Last Post: 11-09-2004, 05:14 AM
  3. Int Main or Void Main?
    By FromHolland in forum C++ Programming
    Replies: 9
    Last Post: 06-12-2003, 04:29 PM
  4. int main (), main (), main (void), int main (void) HELP!!!
    By SmokingMonkey in forum C++ Programming
    Replies: 7
    Last Post: 05-31-2003, 09:46 PM
  5. what to do with the main window
    By stallion in forum Windows Programming
    Replies: 2
    Last Post: 01-28-2003, 08:58 PM