При написании простого кода в мы 2008 возникают ошибки линковки как их исправить?
| Код | 1>------ Build started: Project: winapi, Configuration: Debug Win32 ------ 1>Compiling... 1>1.cpp 1>Linking... 1>uafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___wargv 1>uafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc 1>C:\Мои документы\poject\winapi\Debug\winapi.exe : fatal error LNK1120: 2 unresolved externals 1>Build log was saved at "file://c:\Мои документы\poject\winapi\winapi\Debug\BuildLog.htm" 1>winapi - 3 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
|
Сам код
| Код | #include "stdafx.h" LRESULT CALLBACK WndProc(HWND hwnd, UINT message,WPARAM wParam,LPARAM lParam); BOOL InitApplication(HINSTANCE hInstance); BOOL InitInstance(HINSTANCE hInsatance, int nCmdShow); LPCSTR szClassName="FrameWndAPI"; LPCSTR szTitle="Создание Windows- приложений"; int WINAPI WinMain( HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow) { if(!hPrevInstance) { if(!InitApplication(hInstance)) return FALSE; } if(!InitInstance(hInstance,nCmdShow)) return FALSE; MSG msg; while(GetMessage(&msg,NULL,0,0)) { TranslateMessage(&msg); DispatchMessage(&msg); } typedef struct tagMSG { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; }MSG; return static_cast<int>(msg.wParam); } BOOL InitApplication(HINSTANCE hInstance) { WNDCLASS wc; typedef struct tagWNDCLASSA { UINT style; WNDPROC lpfnWndProc; int cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackgroud; LPCSTR lpszMenuName; LPCSTR lpszClassName; }WNDCLASS; wc.style=CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc=static_cast<WNDPROC>(WndProc); wc.cbClsExtra=0; wc.cbWndExtra=0; wc.hInstance=hInstance; wc.hIcon=LoadIcon(NULL, IDI_ASTERISK); wc.hCursor=LoadCursor(NULL,IDC_CROSS); wc.hbrBackground= reinterpret_cast<HBRUSH>(COLOR_WINDOW+1); wc.lpszMenuName=NULL; wc.lpszClassName=L"FrameWndAPI"; return RegisterClass(&wc); } BOOL InitInstance( HINSTANCE hInstance, int nCmdShow) { HWND hWnd; hWnd=CreateWindow(L"FrameWndAPI",L"Создание Windows- приложений",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL, hInstance,NULL); if(!hWnd)return FALSE; if(ShowWindow(hWnd, nCmdShow)) return FALSE; if(!UpdateWindow(hWnd)) return FALSE; return TRUE; } LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd,message,wParam,lParam);
} return 0; }
|
|