Archived

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

Error lnk2001

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I''m sorry about this guys. Most likely I have a simple problem, that I have been trying to solves for hours. I have been reading through :Tricks of the Windows Game Programming Gurus. And have finally gotten to directdraw. The problem is I get an Error lnk2001 message followed by an error lnk1120 using vc++ 6.0 and dxsdk 9.0 I have #include <Ddraw.h> in the code, and added, Ddraw.h/Ddraw.lib in my project Perhaps showing the actual error will help demo6_3_2.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw4 Debug/DEMO6_3_3.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. I am extremely confused, because I know that the ddraw.lib and ddaw.h I''m using supports up to directdraw7. I think the idea is that lnk2001 causes lnk1120. from searching for an answer the problems may be that I have different versions for directx. One from sdk 9.0 and the other from my vc++ 6.0. I have included the ones from sdk 9.0, but I''m thinking my include statement #include <Ddraw.h> has the compiler search for the wrong one, is this possible? if so how would i correct this. I''m new to programming but extremely excited, and I cannot continue until this problem is resolved. If anyone could give me any information at all I would be much oblidged. Thanks

Share this post


Link to post
Share on other sites
Okay, maybe I''m way off. can anyone tell me this. I obviously include ddraw.h by #include <ddraw.h>, but how do i link ddraw.lib. I add it to my project, but how do i link it to the project itself?
Do i not even need to add ddraw.lib to my project?
Again, any help, or if anyone could tell me where to find the answer to this question would be extremely appreciated

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Yes, you do need to link in ddraw.lib. (unless it''s called ddraw7.lib or ddraw4.lib or something - I don''t use ddraw). You may need to link in dxguid.lib as well. You have a choice of three ways to get libs linked in VC6.

(1) Open the project options, go to the "link" tab, and somewhere you should see a list of .lib files. Add the other .lib files you need to this list. Recommended approach.

(2) There''s a nonstandard directive #pragma comment(lib) used by some compilers (such as VC) to imbed lib-linking info into your source file. Just add the line
#pragma comment(lib, "ddraw.lib"
to one of your cpp source files. This is a nice technique for small projects, when you don''t want to mess around with project files.

(3) You can also link libs from the command line, but you''re probably not linking from the command line anyway, so I won''t explain this method.

Share this post


Link to post
Share on other sites