i am beginer in c++.
i wanna learn win32api.
so, i tried below example using vc++2005 express beta2.
but i met following 2 errors :
Error 1 error LNK2019: unresolved external symbol _main
referenced in function _mainCRTStartup MSVCRTD.lib
Error 2 fatal error LNK1120: 1 unresolved
externals c:\test\parse\winapitest3\winapitest3
\Debug\winapitest3.exe
//--------------------------------------------------------------
here, my example code:
#include <windows.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
HINSTANCE g_hInst;
LPSTR lpszClass="test";//"First";
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE
hPrevInstance ,LPSTR lpszCmdParam,int nCmdShow)
{
HWND hWnd;
MSG Message;
WNDCLASS WndClass;
g_hInst=hInstance;
WndClass.cbClsExtra=0;
WndClass.cbWndExtra=0;
WndClass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
WndClass.hCursor=LoadCursor(NULL,IDC_ARROW);
WndClass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
WndClass.hInstance=hInstance;
WndClass.lpfnWndProc=(WNDPROC)WndProc;
//WndClass.lpszClassName=(LPCWSTR)lpszClass;
WndClass.lpszClassName=lpszClass;
WndClass.lpszMenuName=NULL;
WndClass.style=CS_HREDRAW | CS_VREDRAW;
RegisterClass(&WndClass);
hWnd=CreateWindow(lpszClass,lpszClass,WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
NULL,
(HMENU)NULL,
hInstance,
NULL);
//(LPCWSTR)NULL);
ShowWindow(hWnd,nCmdShow);
while(GetMessage(&Message,0,0,0)) {
TranslateMessage(&Message);
DispatchMessage(&Message);
}
return Message.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd,UINT iMessage,WPARAM wParam,LPARAM lParam)
{
switch(iMessage) {
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return(DefWindowProc(hWnd,iMessage,wParam,lParam));
}
//----------------------------------------

error LNK2019, LNK1120 : win32 API programing by vc++2005 beta2
Rasmus Helmsby Sandberg
exactly solved.
have a nice day :)
galic
Xaz
For Visual Net (and other versions...I hope)
Project/ Propertys....Folder "Linker"/Additional Dependencies/ HERE!!!...You add additional *.lib which you are needing because of you are using additional librarys.
Example: I usually need OpenCV. I have to include into here: cv.lib cxcore.lib highgui.lib cvcam.lib.
Guillaume JAY