DirectDraw & Direct3D compiling error

Started by
2 comments, last by RoyHsu2001 22 years, 1 month ago
I tried to integrate DirectDraw and Direct3D together by the samples, FullScreenMode and Tut06_Mesh. The FullScreenMode was extracted for "included files", "variables", "initial function", "Draw function" and "close function" and attach to the Tut06_Mesh at suitable places; finally, the error seemed not from my code. Does any one could help me? Thanks! common files// ddutil.h ddutil.cpp dxutil.h dxutil.cpp Link library// d3dx8.lib d3d8.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib including files// #include <d3dx8.h> #include <mmsystem.h> #include <windows.h> #include <ddraw.h> #include "resource.h" #include "ddutil.h" compiling// Linking... ddutil.obj : error LNK2001: unresolved external symbol _DirectDrawCreateEx@16 ddutil.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw7 Debug/Meshes.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe.
Advertisement
You have to add ddraw.lib to the link libraries
Hi! I just got Isometric Programming w/ DirectX and having a small problem compiling the Chapter 5 source. It says something like
"unresolved external symbol DirectDrawCreateEX() in module Iso5_1.obj".

I''m including the library in the project, and i''ve got it to work using the same project settings, for the source code in Tricks of the Windows Programming Gurus.

I''m a Borland user...using the DirectX 7 SDK which came w/ the compiler.

Also, would there be any difference if i changed DirectDrawCreateEX() to DirectDrawCreate()? This is the first time I''ve ever seen DirectDrawCreateEX()...and i know they''re similar...

Thanks in advance

Chris
For my problem, i managed to work around it.
Instead of using DirectDrawCreateEX(), I had to use DirectDrawCreate().

Because of that, I had to change a few lines...

in the source, instead of:
hr=DirectDrawCreateEx(NULL,(void**)&lpdd, IID_IDirectDraw7, NULL);

I used:
hr=DirectDrawCreate(NULL, (LPDIRECTDRAW *)&lpdd, NULL);

and after the testing if DirectDrawCreate failed, I added:

if (FAILED(lpdd->QueryInterface(IID_IDirectDraw7, (void**)&lpdd)))
return false;

I did this based off of the way LaMothe created DirectDraw Interfaces in Tricks of the Windows Programming Gurus.

*Had to cast &lpdd to LPDIRECTDRAW* as lpdd is IDirectDraw7.

And void** is the same as (LPVOID *), which is what the parameter looks like in ddraw.h.

I still don''t know what is wrong with DirectDrawCreateEX()...if anyone figures out what my problem is, I would still like to use it...

Chris

This topic is closed to new replies.

Advertisement