Linker error in Hello World program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bajajv
    New Member
    • Jun 2007
    • 152

    Linker error in Hello World program

    Hi,
    I am using Visual Studio 2005. And this basic code is giving the error-
    #include <windows.h>

    int WINAPI WinMain ( HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    PSTR szCmdLine,
    int nCmdShow )
    {
    MessageBox(NULL , TEXT("Hello World"), TEXT("Vipul Bajaj"), 0);
    return 0;
    }
    The error is
    MSVCRTD.lib(crt exe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStar tup

    Plz help.
  • kitty2988
    New Member
    • Jul 2009
    • 1

    #2
    i'm not sure if this is of any help to you at all, but i just compiled it with MinGW (bloodshed devc++) and it ran fine.

    this might be a dumb answer, but maybe its your compiler? thats a pretty simple script to not run. you could also try starting a "new project" or whatever you do in MSVC++. i guess it could be a bad linker.

    Comment

    • Banfa
      Recognized Expert Expert
      • Feb 2006
      • 9067

      #3
      It looks to me like you created a command line project which expects main to exist as is normal for C/C++ programs.

      Comment

      Working...