Thread: error after compiling "hello world" win program !

  1. #1
    C 1337 Meshal's Avatar
    Join Date
    Nov 2006
    Posts
    70

    error after compiling "hello world" win program !

    i don`t know why this error appear !!

    after compiling with Microsoft Visual C++ :

    Code:
    #include <windows.h>
    
    int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                        PSTR szCmdLine, int iCmdShow)
    {
         MessageBox (NULL, TEXT ("Hello, Windows 98!"), TEXT ("HelloMsg"), 0) ;
    
         return 0 ;
    }
    This error occur :

    Code:
    --------------------Configuration: Cpp1 - Win32 Debug--------------------
    Linking...
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/Cpp1.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.
    
    Cpp1.exe - 2 error(s), 0 warning(s)
    my win is XP

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,794
    probably your pproject type is "Win32 Console Application" - it searches for the main()

    If you want to use WinMain - it should be "Win32 Application"
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    David J. Wheeler

  3. #3
    C 1337 Meshal's Avatar
    Join Date
    Nov 2006
    Posts
    70
    thanks it`s work fine to me when i choose
    Windows Application - > win32 empty project ..

    thanks again

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling a program for Mac OSX from a windows computer
    By Jedi Nescioquis in forum Windows Programming
    Replies: 1
    Last Post: 02-13-2009, 03:06 PM
  2. Win Console program environment variable
    By C3Pnuts in forum C Programming
    Replies: 2
    Last Post: 05-23-2005, 02:08 PM
  3. help with this
    By tyrantil in forum C Programming
    Replies: 18
    Last Post: 01-30-2005, 04:53 PM
  4. opengl program as win API menu item
    By SAMSAM in forum Game Programming
    Replies: 1
    Last Post: 03-03-2003, 07:48 PM
  5. program to shutdown Win CE
    By Snoop67 in forum Windows Programming
    Replies: 1
    Last Post: 11-07-2002, 06:32 PM