unresolved external symbol _main
#include
LPARAM CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
PSTR szCmdLine,
int nCmdShow)
{
MSG msg;
HWND hwnd;
WNDCLASSEX wc;
wc.cbSize = sizeof(wc);
wc.style = CS_VREDRAW | CS_HREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL,IDI_WINLOGO);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = "Miguel Angel";
wc.lpszClassName = "Window Class 1";
wc.hIconSm = LoadIcon(NULL,IDI_WINLOGO);
RegisterClassEx(&wc);
hwnd = CreateWindow("Window Class 1",
"Miguel Angel",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LPARAM CALLBACK WndProc(HWND hwnd,UINT imsg,WPARAM wParam,LPARAM lParam)
{
switch(imsg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hwnd,imsg,wParam,lParam);
}
When i write this program, i got this two errors:
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Prueba.exe : fatal error LNK1120: 1 unresolved externals
Could anyone explain what´s wrong, please??
July 20, 2001 05:36 PM
Are you including ?..
I think it overrides that standard "main" so the compiler will accept "WinMain"..
I had this problem once before when I first started win32 programming, I think that''s what it was..
I think it overrides that standard "main" so the compiler will accept "WinMain"..
I had this problem once before when I first started win32 programming, I think that''s what it was..
Assuming you're using MSVC, did you create this project as a Win32 CONSOLE app? Try creating it as a Win32 application....it compiled for me just fine.
Edited by - noparity on July 20, 2001 6:41:23 PM
Edited by - noparity on July 20, 2001 6:41:23 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement