error after compiling "hello world" win program !

This is a discussion on error after compiling "hello world" win program ! within the Windows Programming forums, part of the Platform Specific Boards category; i don`t know why this error appear !! after compiling with Microsoft Visual C++ : Code: #include <windows.h> int WINAPI ...

  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
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    probably your pproject type is "Win32 Console Application" - it searches for the main()

    If you want to use WinMain - it should be "Win32 Application"
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  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, 02: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, 03:53 PM
  4. opengl program as win API menu item
    By SAMSAM in forum Game Programming
    Replies: 1
    Last Post: 03-03-2003, 06:48 PM
  5. program to shutdown Win CE
    By Snoop67 in forum Windows Programming
    Replies: 1
    Last Post: 11-07-2002, 05:32 PM

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