Archived

This topic is now archived and is closed to further replies.

Gunnm

[linker error]

Recommended Posts

Hello guys! Im new to directx, have been doing c++ for a couple of months, I have the "win game programming for gurus" as of today. I tried to compile the first source example in the book and I get errors such as those below. [Linker error] undefined reference to `GetStockObject@4'' [Linker error] undefined reference to `lpddsback'' [Linker error] undefined reference to `Draw_Rectangle(int, int, int, int, int, IDirectDrawSurface7*)'' [Linker error] undefined reference to `lpddsback'' [Linker error] undefined reference to `Draw_Rectangle(int, int, int, int, int, IDirectDrawSurface7*)'' [Linker error] undefined reference to `DD_Init(int, int, int)'' ...it''s more, but I think you got the idea. Im using dev-c++. I have dx9sdk installed and I have set the include-path and the lib-path. I''ve skimmed through the sdk.. but it doesnt say much about linking, so I figure the problem isnt there, but some option in dev-cpp. The sample code makes use of ddraw.h. Do I need to add some parameters for the linker? That is my best guess, since I''ve heard that is needed for OpenGL... if so, what do I need to add? or where can I find info about it? Any hint would be very much appreciated. Thanks for your time. :-)

Share this post


Link to post
Share on other sites
..more specifically, you need to tell the linker to link with the DirectX libraries. haven''t done any DX programming in a while, but from your post, it looks like you''ll at least need to link to ddraw.lib. you may also need to link with dxguid.lib, not sure about that.

Share this post


Link to post
Share on other sites
Ohh.. thanks you guys. I haven''t really figured it out yet.. but I will.

I thought I only needed to include the lib-path in dev-cpp compiler options. Uhn.. I see now I missed some obvious things.

Share this post


Link to post
Share on other sites