tags:

views:

382

answers:

3

I have a small C++ program for Win32, which has the following WinMain:

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)

when trying to compile for x64, I get the following error:

error LNK2019: unresolved external symbol WinMain referenced in function __tmainCRTStartup

What steps must be taken to recompile a simple win32 app for x64?

Thank you

A: 

No promises, but I suspect your problem might be fixed by changing "APIENTRY" to "WINAPI". If this does fix it, the problem was a differing calling convention.

If not, I suspect you need to look at your compiler flags.

Jon Bright
A: 

Never mind, it was just an error in my project file

Enrico Detoma
+1  A: 

Your linker is set to link the executable under the CONSOLE subsystem, thus it's looking for main, you'll need to set the subsystem to WINDOWS.

Irwin