TransparentBlt problem

Started by
3 comments, last by Anon Mike 18 years, 9 months ago
I am using dev c++ and am fairly new to windows programming. I am using the TransparentBlt() function to draw bitmaps to the screen using a transparent color for the background. When I compile the project, it works fine, but I get a linker error that says something like: [Linker error] undefined reference to '_ZN6Bitmap14TransparentBltEP5HDC__...blah blah blah. I think this has something to do with the fact that microsoft declares TransparentBlt() in the msimg32.lib library, but libmsimg32.a (dev c++ "equivalent") is not the same thing. So I need someone to tell me how to get TransparentBlt() to work (in ENGLISH please!) or how to include msimg32.lib into my project. Thank you!
Advertisement
libmsimg32.a does contain the necessary code for you to use TransparentBlt(). Unfortunately I'm not familiar with Dev-C++ (real men use MinGW32/GCC from the command line, or Makefiles when they have to...;), but it'll probably involve either a) adding "-lmsimg32" to something called "Linker Options" or b) adding "msimg32" to something called "Link Libraries" or c) something else like that. Or try "libmsimg32.a". Whatever the case, it has to be associated with the linking stage of the project.
{[JohnE, Chief Architect and Senior Programmer, Twilight Dragon Media{[+++{GCC/MinGW}+++{Code::Blocks IDE}+++{wxWidgets Cross-Platform Native UI Framework}+++
Not sure if this is related, but I had problems with AlphaBlend(), until I found that you had to #define the correct _WIN32_WINNT and WINVER versions (> 0x0500) for certain more advanced GDI functions to be included.
-Scoot
Since the error is a linker error, the compiler was able to find the necessary function prototype in the header, so the includes seem to be working properly.
{[JohnE, Chief Architect and Senior Programmer, Twilight Dragon Media{[+++{GCC/MinGW}+++{Code::Blocks IDE}+++{wxWidgets Cross-Platform Native UI Framework}+++
It looks like the compiler is treating TransparentBlt as a C++ function instead of a C function. You need to wrap whatever header you include to get it in extern "C". e.g:

extern "C"
{
#include <whatever has TransparentBlt in it>
}
-Mike

This topic is closed to new replies.

Advertisement