Advertisement

Magmai - thanks!!!

Started by February 12, 2002 09:44 PM
1 comment, last by ross 22 years, 7 months ago
magmai, you''ve helped me out of a big jam. i had a major ... no, make that a MAJOR jr.-newbie-wet-behind-the-ears problem with a: Unresolved external ''DirectDrawCreateEx'' referenced from C:\MYSOURCE\SOURCE01.OBJ in some thread from dec 01 you recommended adding: #pragma comment(lib, "ddraw.lib") before my #include "ddraw.h" thanks, it worked! i''ve been stuck on this on for a wee ... er, a long time. i''m using borland''s free bcc32 compiler with win xp and dx8.0 any idea why this fix worked? (i''m so happy i''m writing grandmom a snail-mail next!) Sleep is for fools who never see the sun rise
Sleep is for fools who never see the sun rise
Well, I suppose you haven''t been helped until you know why the solution works, so here goes.

the #pragma comment(lib, "filename.lib") preprocessor directive tells the compiler to link the file in at runtime. In your case, this was the directdraw static library. Until the time that you linked this file, your code was making references to an object that didn''t exist, namely the function DirectDrawCreateEx function.

Later,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[if you have a link proposal, email me.]

[twitter]warrenm[/twitter]

Advertisement
Just keep in mind that pragma''s like this are compiler-dependent. I suspect Magmai was thinking about Visual C++ when he wrote that, so if it works for Borland you''re just lucky.

It probably would be better to learn how to link with libraries using your compilers commandline options, instead of stating it in the code itself. If you can''t find it in the docs, I''m sure the people in the turbo forum will be happy to tell you how to do that.

This topic is closed to new replies.

Advertisement