0

New to C++ and trying to make a simple game as a beginners project.

I am using VScode (but I am new to VScode too)

I am getting the error in the title when I try to compile (just to check that it compiles with the stage I am at).

I understand it to be something to do with a linker, but I can only find solutions relating to Visual Studio, not VS code.

//Render
StretchDIBits(hdc, 0, 0, buffer_width, buffer_height, 0, 0, buffer_width, buffer_height, buffer_memory, &buffer_bitmap_info, DIB_RGB_COLORS, SRCCOPY);

The above is the line of code my compiler has issue with.
Up until I have added this code, the program has compiled and done what it was meant too.

frosty1777
  • 11
  • 2
  • That's a Windows API function. You need to link with Gdi32.lib. See documentation: https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-stretchdibits – paddy Nov 05 '22 at 02:33
  • @paddy, Thanks, though that isn't where I am struggling, I don't know how to link it with Gdi32.lib in VSCode. – frosty1777 Nov 05 '22 at 02:37
  • VSCode is just a text editor, you can link with anything in it. See [here](https://stackoverflow.com/questions/16546371/how-to-add-gdi32-lib-from-command-line) and [here](https://stackoverflow.com/questions/53502082/undefined-reference-to-textoutw20-with-gdi32-lib-linked). – Evg Nov 05 '22 at 02:42

0 Answers0