-1

I'm trying to use windows.h function SetPixel() in Code::Blocks but it gives me a linking error undefined reference to SetPixel@16

How could I link the library functions to the project ?

Mostafa 36a2
  • 157
  • 1
  • 15

2 Answers2

2

You need to add -lgdi32 to the linker flags.

Dayal rai
  • 6,548
  • 22
  • 29
1

You need to link the gdi32 library. There's an good answer here on SO that will tell you how to do this: How do I link to a library with Code::Blocks?

Community
  • 1
  • 1
jpw
  • 44,361
  • 6
  • 66
  • 86