3

I am using MinGW compiler with the command line and sublime text 3. While including the header files for DirectX into my C++ code, it gave errors saying they weren't found.

#include <windows.h>
#include <windowsx.h>
#include <d3d11.h>
#include <d3dx11.h>
#include <d3dx10.h>

This results in the following error:

lesson 5.cpp:4:20: fatal error: d3dx11.h: No such file or directory
#include <d3dx11.h>

If I comment out the line it gave an error for, it just gives the same error for the next line.

user4581301
  • 33,082
  • 7
  • 33
  • 54
Ro-Bert
  • 41
  • 4
  • 1
    They are not part of the standard library – Xantium May 26 '18 at 00:02
  • You will have to add a `-I` to the compiler command. There's probably a duplicate for this hanging around. I'll see if I can find one. – user4581301 May 26 '18 at 00:22
  • 1
    You know, I can't find one for mingw, just for Visual Studio. This has me thinking that you might also run into a library mis-match problem. Might be some general help at [How to compile a DirectX 11 app in MinGW](https://stackoverflow.com/questions/9000485/how-to-compile-a-directx-11-app-in-mingw) – user4581301 May 26 '18 at 00:26
  • I tried downloading MinGW-W64 from the links, unless I am doing something wrong, it didn't work. Afterward i did a search on my whole C: drive to find the location of the missing header file (Searching for "d3dx11"). All that came up were the DLL files: d3dx11_43.dll, d3dx11_42.dll (both in C:\Windows\SysWOW64 and \System32) I don't think there are the header files on my computer at all. Did I not download DirectX correctly? – Ro-Bert May 26 '18 at 15:02
  • I actually just found a location in my hard drive with directx headers. dxd11 is in there but the other two are not, should I just find a place to download those two? The location is "C:\Program Files\Haskell Platform\8.2.2\mingw\x86_64-w64-mingw32\include". – Ro-Bert May 26 '18 at 15:20
  • ``D3DX10`` and ``D3DX11`` are utility libraries that only exist in the legacy DirectX SDK. See [MSDN](https://msdn.microsoft.com/en-us/library/windows/desktop/ee663275.aspx). You can and should avoid them in favor of open source replacements. See [Living without D3DX](https://blogs.msdn.microsoft.com/chuckw/2013/08/20/living-without-d3dx/) – Chuck Walbourn May 27 '18 at 09:25
  • @ChuchWalbourn Thank you for that info. I will try to see if I can get a 3D rendering without the legacy DirectX SDK. At the moment, I don't have any questions. When I am finished with getting it to work, I'll try to answer this thread. – Ro-Bert May 28 '18 at 02:19
  • Does this answer your question? [How to compile a DirectX 11 app in MinGW](https://stackoverflow.com/questions/9000485/how-to-compile-a-directx-11-app-in-mingw) – rogerdpack Mar 24 '22 at 05:09

0 Answers0