您好,我是C ++的初学者,我在Glew工作时遇到了问题。我试图在附加依赖项中包含glew32.lib,因此不应存在任何路径问题。我得到的错误是:
错误4错误LNK1120:2个未解析的外部
错误1错误LNK2001:未解析的外部符号“struct HDC__ * hDC”(?hDC @@ 3PAUHDC __ @@ A)
错误3错误LNK2001:未解析的外部符号“struct HGLRC__ * hRC”(?hRC @@ 3PAUHGLRC __ @@ A)
错误2错误LNK2019:未解析的外部符号“struct HDC__ * hDC”(?hDC @@ 3PAUHDC __ @@ A)在函数“public:int thiscall szWindow :: WinClass(struct HINSTANCE * *)中引用)“(?WinClass @ szWindow @@ QAEHPAUHINSTANCE __ @@@ Z)
这是我的代码:
#include "szWindow.h"
#include "szGraphicsEngine.h"
szGraphicsEngine *Graphics = NULL;
int szWindow::WinClass(HINSTANCE hInstance)
{
WNDCLASSEX wc;
ZeroMemory(&wc, sizeof(WNDCLASSEX));
wc.cbSize = sizeof(WNDCLASSEX);
wc.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
wc.hCursor = LoadCursor(hInstance, IDC_ARROW);
wc.hIcon = LoadIcon(hInstance, IDI_APPLICATION);
wc.hInstance = hInstance;
wc.lpfnWndProc = WndProc;
wc.lpszClassName = "SZ";
wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
if(!RegisterClassEx(&wc))
{
MessageBox(NULL, "Could not register windows class", "Fatal Error", MB_OK);
return 0;
}
return 0;
};
int szWindow::WinCreate(HINSTANCE hInstance, char *WinName, int WinWidth, int WinHeight)
{
szhWnd = CreateWindow("SZ", WinName, WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX, 0, 0, WinWidth, WinHeight, NULL, NULL, hInstance, NULL);
if(!szhWnd)
{
MessageBox(NULL, "Could not create window", "Fatal Error", MB_OK);
return 0;
}
Graphics->EnableOGLAPI();
return 0;
}
int szWindow::WinLoop(MSG msg)
{
while(running)
{
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
DispatchMessage(&msg);
TranslateMessage(&msg);
}
else
{
glClear(GL_DEPTH_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
SwapBuffers(hDC);
}
}
return 0;
}
我已将所有内容正确链接,并且我已经仔细检查了所有内容。