473,586 Members | 2,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

No d3dx9.h? -What The Heck?-

161 New Member
Ok, I am trying to create a window using this book called "Introducti on To 3D Game Programming with DirectX 9.0c A shader Approach." By Frank D Luna. I used that hole script on page 98 to where it starts talking about Direct X debuging on one hole script. I got Visual Studios C++, DirectX, DirectX SDK. So whats going on?

Expand|Select|Wrap|Line Numbers
  1. #include <d3dx8.h>
  2. #include <iostream.h>
  4. using namespace std;
  6. class HelloD3DApp : public D3DApp
  7. {
  8. public:
  9.     HelloD3DApp(HINSTANCE hInstance, std::string winCaption, D3DDEVTYPE devType, DWORD, requestedVP);
  10.     -HelloD3DApp();
  12.     bool checkDeviceCaps();
  13.     void onLostDevice();
  14.     void updateScene(float dt);
  15.     void drawScene();
  17. private:
  19.     ID3DXFont* mFont;
  20. };
  22. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, prevInstance, PSTR cmdLine, int showCmd)
  23. (
  24.     //Enable run-time memory check for debug builds.
  27. #endif
  29. HelloApp app(hInstance);
  30. gd3dApp = &app;
  32.  return gd3dApp->run();
  33. }
  35. HelloD3DApp::HelloD3DApp(HINSTANCE, hInstance, std::string winCaption, D3DDEVTYPE devType, DWORD requestedVP): D3DApp(hInstance, winCaption, devType, requestedVP)
  36. {
  37.     srand(time_t(0));
  39.     //Check the memory and make sure their are no errors other wise then make a error and shutdown.
  40.     if(!checkDeviceCaps())
  41.     {
  42.     MessageBox(0, "CheckDeviceCaps() Failed", 0, 0);
  43.     PostQuitMessage(0);
  44.     }
  45.     D3DXFONT_DESC fontDesc;
  46.     fontDesc.Height = 80;
  47.     fontDesc.Width = 40;
  48.     fontDesc.MipLevels = 0;
  49.     fontDesc.Italic = true;
  50.     fontDesc.CharSet = DEFAULT_CHARSET;
  51.     fontDesc.OutputPrecision = OUT_DEFAULT_PRECIS;
  52.     fontDesc.Quality = DEFAULT_QUALITY;
  53.     fontDesc.PitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
  54.     _tcscpy(fontDesc.FaceName, _T("Times New Roman"));
  56.     HR(D3DXCreateFontIndirect(gd3dDevice, &fontDesc, &mFont));
  57. }
  59. HelloD3DApp::~HelloD3DApp()
  60. {
  61. releaseCOM(mFont);
  62. }
  64. #define ReleaseCOM(x) { if(x){x->Release();x = 0;}}
  66. bool HelloD3DApp::checkDeviceCaps()
  67. {
  68.     //Nothing to check
  69.     return true;
  70. }
  72. void HelloD3DApp::updateScene(float dt)
  73. {
  75. }
  77. void HelloD3DApp::onLostDevice()
  79. {
  80.     HR(mFont->OnLostDevice());
  81. }
  83. void HelloD3DApp::onResetDevice()
  84. {
  85. HR(mFont->OnResetDevice());
  86. }
  88. void HelloD3DApp::drawScene()
  89. {
  90.     HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_xRGB(225, 225, 255), 1.0f, 0);
  92.     RECT formatRect;
  93.     GetClientRect(mMainWnd, &formatRect);
  94.     HR(gd3dDevice->BeginScene());
  96.     mFont->DrawText(0, _T("Hello Direct3D"), -1, &formatRect, DT_CENTER | DT_VCENTER, D3DCOLORXRGB(rand() % 256, rand() % 256));
  98.     HR(gd3dDevice->EndScene());
  99.     HR(gd3dDevice->Present(0,0,0,0));
  100. }
Jun 16 '07 #1
7 16755
9,208 Recognized Expert Moderator Expert
What was your question?

If you have trouble with Windows code, start reading "Programmin g Windows" by Charles Petzold for the background.
Jun 17 '07 #2
161 New Member
The compiler is telling me it can't find d3dx9.h. Even the windows.h file. Is there something else I must download to continue my DirectX project? I have been playing around with it, but so far it keeps showing the same error that it can't find it.
Jun 17 '07 #3
15 New Member
The catch is the compiler doesn't necessarily *know* where the Windows and DirectX headers are at. While you didn't specify what compiler you use, there should be a set of options for your current project along the lines of "Additional Include Directories" (VC2005) or similar. Tell it the location of said headers in there. What I prefer to do (and this also makes your code a bit more release-friendly) is copy the main folders of any and all APIs used in my program into my working directory, keeping the dir structure, obviously. Anyhow all you have to do at that point is put the directory your header resides in before the name and you're golden. Even works for libraries too. If you're more visual, here's how my DX9 renderer class works/looks:

Expand|Select|Wrap|Line Numbers
  1. #pragma once
  3. #include "Renderer.h"
  5. // DirectX stuff
  6. #include "DirectX\d3d9.h"
  7. #pragma comment (lib, "DirectX/libs/d3d9.lib")
  9. class CRendererDX9 : public Renderer...
  10. yada yada yada
I remember this kind of problem really used to drive me nuts before I started using that little trick.
Jun 17 '07 #4
161 New Member
I'm using the 2005 version. I thought there was something I had to download, but then I'll try that and see what happens.
Jun 17 '07 #5
Is there somewhere I can download all the necessary include files (all the ones referenced by d3dx9.h) in a small (not 400mb) package???

Oct 18 '10 #6
Your best bet would be the sdks. If you dont want to dl a 400mb file. I dont have anything i cant help with
Oct 19 '10 #7
246 New Member
Your best bet is to find the headers and download them directly, and place them in your project folder if you don't want to download a large installer...

But your probably better off doing the installer, and setting up your compiler to look into a SDK header include folder so you don't have to remember to copy/paste a header file into your project every time you need one.

Food for thought.
Oct 19 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Ducati916 | last post by:
hey guys just signed up and i hope to make this forum my second home :) anyways i want to go right into game programing so i installed DX9 SDK and started reading but when it come to testing some of the samples they wont compile. says: cannot find "d3dx9.h" no such file or directory the file is there i checked twice and reinstalled DX9...
by: Edward Mitchell | last post by:
I am converting a project that uses DirectX and worked under VS.NET 2003. Now when I convert the project to .NET 2005, there are linker errors for _Xran and _Xlen as follows: dx9.lib(WinConsole.obj) : error LNK2019: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " ... .... dx9.lib(WinConsole.obj) :...
by: Alerion | last post by:
Hello everyone, I've been a regular of this forum but this is my first post, generally I can find the answer to my question already, but this time I'm having a somewhat specific problem. For fun I've been working on making a 3d game (who hasn't haha) and while it's nothing special at the moment I was making some decent headway. I'm working...
by: dragonslayer008 | last post by:
I recently added some new code files to a C++/CLI project. The added code is all native. I simply added the code to the project and built it. It compiled fine but I am getting the linker error: LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (IDirect3DDevice9): (0x0200015b) I get this...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.