简体   繁体   中英

LNK2019: unresolved external symbol _main referenced in function __tmainCRTStartup

#include <windows.h> 

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,nShowCmd)
{
    MessageBox(NULL, L"Hello World!", L"Just another Hello World program!", MB_ICONEXCLAMATION | MB_OK);
    return 0;
}

Working through a tutorial for getting started with c++ and can't get the first hello world example to compile.

Using visual studio express 2012. All I've done is create a new project and copy this into it replacing the tmain function.

please does anyone know how to resolve this?

In standard C++ program you must have main function so program knows where to start

int main()
{
   return 0;
}

Maybe try another tutorial. This one seems good. http://blogs.msdn.com/b/devschool/archive/2013/01/08/writing-your-first-c-program-using-visual-studio-2012.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM