How do use Direct3DCreate9?

Started by
4 comments, last by jflanglois 17 years, 10 months ago
I am trying to render a scene and have been following the tutorial that comes with the help files in the sdk. When I come to compile it, I recieve the following error: t.obj : error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function _wWinMain@16 C:\Documents and Settings\Michael\My Documents\Visual Studio 2005\Projects\t\Debug\t.exe : fatal error LNK1120: 1 unresolved externals I looked this it up, and it told me that it does not know this function. I am only using the #import d3d9.h command. WHat can you recommend? One other point sorry. WHile looking through the sample browser, I recieve the following error on some of the samples: The referance device was selected but your computer only has a reduced-functionality referance device installed. Install the directx sdk to get the full referance device I obviously have the sdk installed to get the sample browser. How can I correct this? Thanks, Mike
Advertisement
You need to link to d3d9.lib. Go to "Project->Properties->Configuration Properties->Linker->Input->Additional Dependencies" and add "d3d9.lib dxguid.lib" to that.

Also, I'm not too sure about #import. If you get further problems, change it to #include <d3d9.h>.


jfl.
I think the reference device it refers to is the reference rasterizer that comes with Direct3D. This is a pure software device that supports all Direct3D features, but is sloooow. The SDK samples will switch to this if your card can not support everything required. AFAIK, there are different versions of the reference rasterizer, though. You need the full Debug SDK to get all functionality out of the reference rasterizer, others just have a dummy version that doesn't actually do anything (it basically fills out all the classes with empty functions).
Thanks guys,

The additional dependencies worked a treat, although there was no linker option under Configuration Properties, but I think I know why. I am using Visual Express, and it has "some of the more advanced features removed". To get round this I just modified the corewin_express file directly.

Second thing, I reckon youre right about the referance device. I have a GeForce 3 (!, soon to be upgraded to 7900GT SLI), so the referance will be used. I did install the debug version though...

Anyhow, thanks for all the help, and I will post a reply about the referance device when I upgrade the card.

Thanks again,
Mike
Also, if I remember, you actually have to enable the reference device in the Direct3D settings. By default, it uses the blank reference device, so yo uhave to go into the Direct3D settings (with the utilities or config panel that comes with DirectX), and enable it.
Configuration Properties should be in the Express Edition. Try finding it again. Note that the way you did it will link the DirectX libraries to all projects you make.

This topic is closed to new replies.

Advertisement