views:

44

answers:

2

i have following code in visual c++

#include<Windows.h>

LPCTSTR Caption=L"Application programming INTERFACE";

INT WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPPREVInstance,
                      LPSTR lpCmdLINE,int nCmdShow)
{

    MessageBox(NULL,L" Welcome to win32 Application Develepment\n",Caption,MB_YESNOCANCEL| MB_ICONQUESTION);
    return 0;
}

but errors are

1>------ Build started: Project: win321, Configuration: Debug Win32 ------
1>Build started 7/31/2010 1:28:31 PM.
1>InitializeBuildStatus:
1>  Touching "Debug\win321.unsuccessfulbuild".
1>ClCompile:
1>  win32.cpp
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>c:\users\david\documents\visual studio 2010\Projects\win321\Debug\win321.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.58
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
+1  A: 

If your compiling a windows project then make sure you have the application type selected as 'Windows Application' not 'Console Application'.

Dave18
A: 

Also, VS uses wWinMain if you want to use Unicode.

DeadMG