Jump to content
  • Advertisement


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


Library linking problem with Win32 API

This topic is 5138 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

First of all, I am using Dev-C++ v. 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"):
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);
         BitBlt(hDC, x, y, GetWidth(), GetHeight(), hMemDC, 0, 0, SRCCOPY);
      // Restore and delete the memory device context

      SelectObject(hMemDC, hOldBitmap);
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
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
Thanks a lot! I added #define WINVER 0x0500 in Bitmap.h and it works now... man that was confusing.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!