PDA

View Full Version : Linking errors?



R0b0t1
05-04-2008, 09:39 PM
When I try to compile this (http://cpp.pastebin.com/f36ef244c), I get lots of these: [Linker error] undefined reference to `CreateCompatibleDC@4', [Linker error] undefined reference to `CreateCompatibleBitmap@12', [Linker error] undefined reference to `SelectObject@8' (etc.)

Yakman
05-04-2008, 11:05 PM
get the linker to link with static library gdi32
mingw calls it libgdi32.a
you would use the "-L" flag to specify the path to the library
or just get dev-cpp to do it, somewhere in project options


how did i know which library to link to?
1. google "CreateCompatibleBitmap"
2. go to this page (http://msdn.microsoft.com/en-us/library/ms532287(VS.85).aspx) (first result)
3. scroll down until you see "requirements", and there it is "Library: Use Gdi32.lib."

R0b0t1
05-04-2008, 11:42 PM
Well, yeah, always knew it was in GDI... But not sure that was my problem, thanks.