• Advertisement

Archived

This topic is now archived and is closed to further replies.

unresolved external symbol _main

This topic is 6060 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

#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??

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
your source file should have cpp extension

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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..

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Hi- I just went through a similar problem- check out the beginner section- post titled something like "Linking error- solved ty"

Share this post


Link to post
Share on other sites

  • Advertisement