Archived

This topic is now archived and is closed to further replies.

Wraith_1

Library linking problem with Win32 API

Recommended Posts

Wraith_1    122
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]

Share this post


Link to post
Share on other sites
SiCrane    11839
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.

Share this post


Link to post
Share on other sites