0

I am reviewing a legacy code in C++ in Visual Studio 2008. When adding the static lib d3dx9.h it throws the following error at compilation (for a number of files):

Compiling...
Menu.cpp
c:\users\jason\desktop\slot project\video_engine.h(33) : fatal error C1083: 
Cannot open include file: 'd3dx9.h': No such file or directory
MAIN.cpp
c:\users\eduardo\desktop\slot project\video_engine.h(33) : fatal error C1083: 
Cannot open include file: 'd3dx9.h': No such file or directory
GameSettings.cpp
c:\users\eduardo\desktop\slot project\video_engine.h(33) : fatal error C1083: 
Cannot open include file: 'd3dx9.h': No such file or directory
...
...
...

This lib is included in video_engine.h:

#include "d3dx9.h"
#pragma comment(lib, "platform\\DirectX\\d3d9.lib")
#pragma comment(lib, "platform\\DirectX\\d3dx9.lib")

Likewise, the header video_engine.h is included directly (#include...) and indirectly (including a file that already included this header...) by a number of files. For instance, Menu.cpp does not include this header, but it (Menu.cpp) does include MAIN.cpp which includes the header (video_engine.h).

Thanks in advance for any suggestions !

In addition, below the Property Pages for AdditionalIncludeDirectories and Linker's AdditionalDependencies and AdditionalLibraryDirectories:

enter image description here enter image description here

7
  • 1
    Well, where is the file d3dx9.h in fact located? Does it exist at all? You've mentioned a .lib file with a related name, but that's an altogether different thing. Commented Oct 4, 2017 at 18:46
  • 1
    You need to download and install legacy DirectX SDK and then set project include and lib dirs to point at right locations. Commented Oct 4, 2017 at 18:53
  • John Bollinger, good comment. The error shown above is having no header at all. when I included in either the project's or platform directory, it throws: Commented Oct 4, 2017 at 18:57
  • Compiling... Menu.cpp c:\Users\Eduardo\Desktop\Slot Project\platform\d3dx9.h(47) : fatal error C1083: Cannot open include file: 'd3dx9math.h': No such file or directory Commented Oct 4, 2017 at 18:57
  • VTT, the project implements DirectX 9. I downloaded the DirectX SDK, but I am not certain what the legacy is. Commented Oct 4, 2017 at 19:00

1 Answer 1

1

Error No such file or directory usually happens when the compiler cannot find the folder or cannot gain access to a folder or file. Try using Run as Administrator for Visual Studio. Also, in the Additional include directories you should give the full path of the include directory. most C++ libraries have this structure:

  • bin
  • lib
  • include

If we Assume our lib is in the C:\ folder, We should enter the: C:\Libs\Boost\include** in the **Additional include directories.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.