SRL Archive - C/C++ Help and Tutorials

Linking errors?


R0b0t1

2008-05-04 17:39:49

When I try to compile this, 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

2008-05-04 19:05:12

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 (first result)
3. scroll down until you see "requirements", and there it is "Library: Use Gdi32.lib."

R0b0t1

2008-05-04 19:42:20

Well, yeah, always knew it was in GDI… But not sure that was my problem, thanks.