Hi I get the common Undefined References error in CodeBlocks I am pretty sure The code is right.

case WM_PAINT:
		{
            BITMAP bm;
			PAINTSTRUCT ps;

			HDC hdc = BeginPaint(hwnd, &ps);

			HDC hdcMem = CreateCompatibleDC(hdc);
			HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmAnime);

			GetObject(g_hbmAnime, sizeof(bm), &bm);

			BitBlt(hdc, 150, 100, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);

			SelectObject(hdcMem, hbmOld);
			DeleteDC(hdcMem);

			EndPaint(hwnd, &ps);
		}

compiler error:

obj\Debug\aimain.o:aimain.cpp:(.text+0x214)||undefined reference to `_CreateCompatibleDC@4'|
obj\Debug\aimain.o:aimain.cpp:(.text+0x22e)||undefined reference to `_SelectObject@8'|
obj\Debug\aimain.o:aimain.cpp:(.text+0x250)||undefined reference to `_GetObjectA@12'|
obj\Debug\aimain.o:aimain.cpp:(.text+0x29b)||undefined reference to `_BitBlt@36'|
obj\Debug\aimain.o:aimain.cpp:(.text+0x2b0)||undefined reference to `_SelectObject@8'|
obj\Debug\aimain.o:aimain.cpp:(.text+0x2be)||undefined reference to `_DeleteDC@4'|
||=== Build finished: 6 errors, 0 warnings ===|

anyone knows how to fix this ?

You need to link "gdi32.dll" into your project :)

Chris

where can i set that link and where do i get gdi32.dll ??

Project -> Build Options -> Linker -> add -> gdi32

Chris

thx will marking this as solved and hope this will help me for future references

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.