Library linking problem with Win32 API

Started by
1 comment, last by Wraith_1 19 years, 11 months ago
First of all, I am using Dev-C++ v. 4.9.8.0 and just starting in to game programming through "Sams Teach Yourself Game Programming in 24 Hours". I am up to Chapter 6, and am having a problem compiling due to TransparentBlt. I am aware that TransparentBlt requires the linking of the msimg32 library, and have attempted to include it by adding "-lmsimg32" (no quotes) under the "Linker" section of the "Additional Command-Line Options:" section in the project settings (Parameters tab). Despite this, (and I've tried numerous other ways of telling the linker to link the library), I get the following error messages after attempting to compile (line and filename information removed--file is "Bitmap.cpp"):
quote: In member function `void Bitmap::Draw(HDC__*, int, int, int, long `TransparentBlt' undeclared (first use this function) (Each undeclared identifier is reported only once for each [Build Error] [Bitmap.o] Error 1
Here is the source for the function TransparentBlt is used in (not that this should have anything to do with it, I don't think):

void Bitmap::Draw(HDC hDC, int x, int y, BOOL bTrans, COLORREF crTransColor) {
   if (m_hBitmap != NULL) {
      // Create a memory device context for the bitmap

      HDC hMemDC = CreateCompatibleDC(hDC);
      
      // Select the bitmap into the device context

      HBITMAP hOldBitmap = (HBITMAP)SelectObject(hMemDC, m_hBitmap);
      
      // Draw the bitmap to the destination device context

      if (bTrans)
         TransparentBlt(hDC, x, y, GetWidth(), GetHeight(), hMemDC, 0, 0, 
         GetWidth(), GetHeight(), crTransColor);
      else
         BitBlt(hDC, x, y, GetWidth(), GetHeight(), hMemDC, 0, 0, SRCCOPY);
      
      // Restore and delete the memory device context

      SelectObject(hMemDC, hOldBitmap);
      DeleteDC(hMemDC);
   }
}
So you know, I have looked at many links from Google and already searched this forum for any related problems. I found almost nothing useful on Google and while I found a few somewhat similar problems here nothing solved mine. I hope someone will be able to help. Thanks! [edited by - Wraith_1 on May 24, 2004 7:51:48 PM]
Advertisement
This isn''t a linker error. It sounds like it''s not being pulled from the header correctly. Make sure WINVER is defined to be greater than or equal to 0x0500 in your project.
Thanks a lot! I added #define WINVER 0x0500 in Bitmap.h and it works now... man that was confusing.

This topic is closed to new replies.

Advertisement