I'm trying to draw an image to a Win32 Window, but as soon as I try to use BitBlt()
or any other function from <wingdi.h>
, I get an error. This is the code where I use these functions:
#include <windows.h>
...
void MainWindow::UpdatePieces() {
PAINTSTRUCT ps;
HDC hdc;
BITMAP bitmap;
HDC hdcMem;
HGDIOBJ oldBitmap;
hdc = BeginPaint(m_hwnd, &ps);
hdcMem = CreateCompatibleDC(hdc);
oldBitmap = SelectObject(hdcMem, WhiteKing);
GetObject(WhiteKing, sizeof(bitmap), &bitmap);
BitBlt(hdc, 0, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, oldBitmap);
DeleteDC(hdcMem);
EndPaint(m_hwnd, &ps);
}
...
This is the error I get:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol __imp_CreateCompatibleDC referenced in function "private: void __cdecl MainWindow::UpdatePieces(void)" (?UpdatePieces@MainWindow@@AEAAXXZ) C++Learn C:\Users\lives\source\repos\C++Learn\C++Learn\main.obj 1
Error LNK2019 unresolved external symbol __imp_DeleteDC referenced in function "private: void __cdecl MainWindow::UpdatePieces(void)" (?UpdatePieces@MainWindow@@AEAAXXZ) C++Learn C:\Users\lives\source\repos\C++Learn\C++Learn\main.obj 1
Error LNK2019 unresolved external symbol __imp_SelectObject referenced in function "private: void __cdecl MainWindow::UpdatePieces(void)" (?UpdatePieces@MainWindow@@AEAAXXZ) C++Learn C:\Users\lives\source\repos\C++Learn\C++Learn\main.obj 1
Error LNK2019 unresolved external symbol __imp_GetObjectW referenced in function "private: void __cdecl MainWindow::UpdatePieces(void)" (?UpdatePieces@MainWindow@@AEAAXXZ) C++Learn C:\Users\lives\source\repos\C++Learn\C++Learn\main.obj 1