Jump to content
  • Advertisement
Sign in to follow this  
marcin - rem

undefined reference to DirectDrawCreate@12

This topic is 4810 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

C:/Dev-Cpp/Projects/DirectX Image/myframe.cpp:32: undefined reference to `DirectDrawCreate@12' I know that libraries should be included, and I did it with ddraw.lib from the dxsdk\library directory, but still I've got this linker error. So what should I link.

Share this post


Link to post
Share on other sites
Advertisement
Just a thought... sometimes includes can get a bit anal.
Make sure you're including DDraw.h in the file that references DirectDrawCreate, and also try adding DDraw.h and DDraw.cpp to your project (this can solve some weird linker errors).

Share this post


Link to post
Share on other sites
Strange.. That looks like a fastcall name decoration (where 12 stands for the number of bytes of arguments).
You could get the compiler to come up with such a name in C if you changed the default calling convention, though I don't see how it could happen in C++ without manually adding a function declaration.
Still.. Including <ddraw.h> should be enough unless perhaps one of Microsoft's strange include guards is acting up, try changing the order of includes around a bit to see if it helps.

Share this post


Link to post
Share on other sites
...wait a minute... did you include dxguid.lib? and place ddraw.lib and dxguid.lib before your other lib includes? Not doing that can cause it to act up too.

Share this post


Link to post
Share on other sites
You could try declaring it yourself, it should clash with the other incorrect declaration and show you where it is.
Here's the correct version:
extern "C" HRESULT WINAPI DirectDrawCreate( GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter );

Or you could link it in dynamically through LoadLibrary and GetProcAddress, or even import it as a COM interface.

[Edited by - doynax on September 13, 2005 2:22:32 PM]

Share this post


Link to post
Share on other sites
doynax I don't know if that can help, becouse the problem is not with compiler but linker, linker doesn't see the directdrawcreate function in the library. This problem often occurs when the priopriate library is not linked. But I checked your idea, the result is still the same. What do you do when you create directx program. I just added the libraries from the dxsdk\lib folder and called directdraw. Please help me people. I tried to search something on google. But there is handfull of pages where somebody had this problem. And they solved it by adding ddraw.lib, so I'm doing it and no result. maaaaaaaaaaaaan I'm tired.

Share this post


Link to post
Share on other sites
Hmm, please list the libraries you included, and the version of DirectDraw you are using(Adding in your DirectDrawCreate code line would help too). That'll give us a better idea of what's going on.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!