Help with win32 app

This is a discussion on Help with win32 app within the C++ Programming forums, part of the General Programming Boards category; i am having a problem linking this code can anyone tell me what is wrong ----begin file Code: #include<windows.h> INT ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    44

    Help with win32 app

    i am having a problem linking this code can anyone tell me what is wrong
    ----begin file
    Code:
    #include<windows.h>
    
    INT WINAPI WinMain(HINSTANCE hInstance,
    HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){
    
    	MessageBox(NULL,"Welcome to my first Win32 App!!!",
    		"Hello",MB_OK);
    
    	return 0;
    }
    -----end file

    the error output is
    ---begin
    Linking...
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/hello.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    ----end
    please help

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    You're compiling as a console program, not a Windows application.
    My best code is written with the delete key.

  3. #3
    Registered User dalek's Avatar
    Join Date
    May 2003
    Posts
    135
    You have created a windows console project and the compiler expects the entry point to be main, not WinMain.

    Try setting up a Win32 project not a console project.

    Edit: Damn she's quick!

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>unresolved external symbol _main
    You're compiling it as a console app, change your compiler options to make a Windows app instead.

    [edit]dammit!
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Adding a console window to a Win32 app
    By VirtualAce in forum Game Programming
    Replies: 7
    Last Post: 02-01-2009, 12:09 PM
  2. confusion win32 -console app
    By GanglyLamb in forum C Programming
    Replies: 2
    Last Post: 06-11-2003, 10:12 AM
  3. win32 and consele app.
    By master2000 in forum C++ Programming
    Replies: 5
    Last Post: 12-22-2002, 10:50 AM
  4. Console App Vs Win32
    By Jez_Master in forum C++ Programming
    Replies: 1
    Last Post: 04-07-2002, 05:46 PM
  5. Is it possible to get a console up with a win32 app?
    By SilentStrike in forum Windows Programming
    Replies: 2
    Last Post: 12-18-2001, 04:15 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21