An extension to the visual C++ fatal error c1083: cannot open include file 'd3d9.h' etc.

I'm just trying to compile the empty project from the sdk in C++, but it can't find all included files... how can I add the reference to these include files
I am able to compile it in C#, but not in C++...



Answer this question

An extension to the visual C++ fatal error c1083: cannot open include file 'd3d9.h' etc.

  • steve_thomas

    I have v6, 2003 and 2005 editions of C++ on my computer and a search of objbase.h came up with just the following:

    • include path of the Visual C++ 6.0 installation directory.
    • vc7\PlatformSDK\include path of the Visual Studio 2003 installation directory.

    In My 2005 setup I have the following directories set up in includes :

    • DirectX 9 (Feb Edition) \include
    • (VCInstallDir)\include
    • (VCInstallDir)\PlatformSDK\include
    • (FrameworkSDKDir)include

    The library paths are as follows:

    • All of the above except for lib and the following:
    • SDK\2.0\lib in the 2005 installation path
    • (VSInstallDir)
    • (VSInstallDir)lib

    And then there is the reference directories. It seems that this is where we tell the system where to search for references. I have never touched mine and they read as follows:

    • $(FrameworkDir)$(FrameworkVersion)

    This seems to relate to SDK\2.0 folder of the 2005 installation and SDK\1.1 folder of the 2003 installation respectively dependant on which software is being used. Theoretically you could set this up so that all software uses the same framework but not worth messing about with that now that Ive finally got my program sorted out :D

    Hopefully this helps you find your weakness .. good luck.


  • Narahari

    The Visual C++ compiler has a number of directories that it will search when looking for #include'd (or linked) files. Quite simply, you haven't configured yours to search in the correct place

    Usually, if you install the SDK after you install your IDE then it will configure it accordingly.

    In Visual C++, go to the "Tools" menu, select "Options". Expand the "Projects and Solutions" node on the left-hand side. Select "VC++ Directories". You should see a pane with a list of folders... Use the drop-down in the top right ("Show directories for..") to be "Include Files". Add the \include folder from your SDK installation. You might want to add the \lib folder to the "Library Files" section as well.

    Click "okay" and you're ready to go!

    hth
    Jack


  • araxth

    I initially had the same problem and took the advice given above, it sorted it.  I was immediately hit with another, very similar problem.  The compiler, having found the d3d9.h file, complained with the error message:

     

    Error    1          fatal error C1083: Cannot open include file: 'objbase.h': No such file or directory          

     

    On investigating the error it appeared to be line 40 of the d3d9.h file that was causing the problem.  The line of code is given here:

     

    #include <objbase.h>

     

    I thought that maybe a similar problem had occurred so I ran a search on objbase.h to find its directory so that I could include it in the project.  The search turned up no results so I was wondering if anyone knows what this problem is and/or how to solve it.  I am using the Express version of VC++ 2005, but according to Microsoft the Express editions are fully compatible with D3D9, so I don’t believe that’s the problem.  Any help would be greatly appreciated.


  • An extension to the visual C++ fatal error c1083: cannot open include file 'd3d9.h' etc.