0
我不斷收到以下錯誤,當我嘗試編譯我非常簡單的程序:未定義的參考`的WindowProc(HWND __ *,無符號整型,無符號整型,長)@ 16'
未定義引用的WindowProc( HWND __ *,unsigned int,unsigned int,long)@ 16'
我沒有看到問題,它讓我瘋狂!
#include <iostream>
#include <windows.h>
using namespace std;
int sizeX = 500;
int sizeY = 500;
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
char szClassName[ ] = "WindowsApp";
int WINAPI WinMain(
HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil
)
{
HWND hwnd;
MSG messages;
WNDCLASSEX wincl;
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProc;
wincl.style = CS_DBLCLKS;
wincl.cbSize = sizeof(WNDCLASSEX);`
wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor(NULL, IDC_ARROW);
wincl.lpszMenuName = NULL;
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
if(!RegisterClassEx(&wincl))
return 0;
hwnd = CreateWindowEx(
0,
szClassName,
"Windows App",
WS_SYSMENU,
CW_USEDEFAULT,
CW_USEDEFAULT,
sizeX,
sizeY,
HWND_DESKTOP,
NULL,
hThisInstance,
NULL
);
}
代碼有什麼問題?
哪裏是'WindowProc'?你宣佈它,但實際功能在哪裏? – PaulMcKenzie