# damned win api

This topic is 4670 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

ok, now i get a linker error when i try to use createpen and draw graphic primitives. it was all sounding so simple in the book, but for some reason i'm having probs with it. the compiler tells me that i'm making an undefined reference when i try to use one of the drawing functions

##### Share on other sites
Can you post the exact error messages? Oh and make sure that you are including the libraries in your project. Project-Properties-Linker-Input in Visual C++.

##### Share on other sites
Blizzard.o(.text+0x267):Blizzard.cpp: undefined reference to CreatePen@12'
Blizzard.o(.text+0x27b):Blizzard.cpp: undefined reference to SelectObject@8'
Blizzard.o(.text+0x291):Blizzard.cpp: undefined reference to Ellipse@20'
Blizzard.o(.text+0x29f):Blizzard.cpp: undefined reference to DeleteObject@4'

and i'm using dev, not microsoft. i got the code out of a book, and the cd code compiles fine.... all the include files and liked files appear to be the same

##### Share on other sites
jflanglois - he will need to use either "-lGdi32" or "-libGdi32.a" for Dev-CPP [wink]

##### Share on other sites
Make sure that you link in gdi32.lib into your prject. I think for dev c++ you need to use -lgdi32.a

EDIT: Ah, beaten

##### Share on other sites
Quote:
 Original post by Drew_Bentonjflanglois - he will need to use either "-lGdi32" or "-libGdi32.a" for Dev-CPP [wink]

Yeah, I wasn't sure how to do it in Dev, and needed to reinstall it.
He could also go to Project->Project Options->Parameters->Add Library or Object.

jfl.

##### Share on other sites
it appears to be there. in my compiler options, in libraries, is the folder lib, in that folder is a file called libgdi32.a, looks like the right one to me. is there any preprocessor directive i could try to specifically include that file?

##### Share on other sites
#pragma comment(lib, "libgdi32.a")

##### Share on other sites
well, then that's not what's wrong.... it still gives me the linker error. (oh no... this isn't frustrating..... defenestrates monitor)