unresolved external symbol _WinMain@16

Started by
2 comments, last by Servant of the Lord 10 years, 11 months ago

#include <windows.h>
int WINAPI winMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd)
{
    MessageBox(NULL,L"Some text",L"Info",MB_OKCANCEL | MB_ICONINFORMATION);

    return 0;
}

Error 1 error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup C:\Bob\Projects\Part1\Part1\MSVCRTD.lib(crtexew.obj) Part1

~~~~ Salami ~~~~

Advertisement

That .cpp/.c file where you entered that code, make sure you add it to the project. Right Click on the Solution Explorer and choose "Add". Once the file shows up there it should be compiled and linked.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

It should be WinMain not winMain, that's about it.

Why was the original post deleted? In the GameDev.net community, we generally leave them in place for future programmers who have the same problem.

Zaoshi Kaba's solution is the correct answer; it's an easy mistake to make and one that future programmers will likely make and need to know the solution of.

This topic is closed to new replies.

Advertisement