0

I'm new on here and unfortunalety my English is pretty bad. I'm working on my program, I'm trying to make tunnel effect on desktop(like MEMZ...). I get an error like this: "undefined reference to '_imp__StretchBlt@44'"

int main(){
const HWND ali2 = GetDesktopWindow();
    RECT masadikdortgen;
    GetWindowRect(ali2,&masadikdortgen);
    int xDest;
    int yDest;
    xDest = masadikdortgen.right;
    yDest = masadikdortgen.bottom;
    HWND desk = GetDesktopWindow();
     HDC ali = GetDC(desk);
    StretchBlt( ali, 50, 50, xDest - 100 , yDest - 100, ali, 0, 0, xDest, yDest, SRCCOPY);
        }
Arda AKKAYA
  • 13
  • 1
  • 2
  • 1
    Provided in gdi32.lib. If you're not linking against that in your build command (which we can't see), that's your problem. – WhozCraig Feb 29 '20 at 20:44
  • I'm using DEV-C++. – Arda AKKAYA Feb 29 '20 at 21:21
  • How can i do it? – Arda AKKAYA Feb 29 '20 at 21:22
  • 1
    Couldn't tell you. I don't use that IDE. However, it doesn't change anything I said. Somewhere in that build environment is a linker configuration, and it includes the ability to specify which libs to link with. The winsdk lib you need is gdi32.lib (the import library for gdi32.dll). – WhozCraig Feb 29 '20 at 21:23
  • Does this answer your question? [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Alan Birtles Feb 29 '20 at 22:32
  • How to link to gdi32.lib https://stackoverflow.com/questions/40696388/how-to-add-gdi32-lib-correctly-from-within-the-file – Byteboon Feb 29 '20 at 23:13

1 Answers1

0

I had a similar issue in DevCPP. Find "Tools" in the toolbar, and find "Compiler Options" When the Window opens, you have the option "Add following commands when calling the linker" and a checkbox. Check it, and write this in it: -lgdi32 After this, you can compile your code without problems.