0

I am using Visual Studio 2017 and I'm required to use DirectX9.0 for a school project.

I have a solution with 3 projects. One is a static library (.lib), one is an application (.exe) and one is a unit test project:

enter image description here

KB01_Game.exe imports KB01_Engine.lib like so:

KB01_Game properties enter image description here

KB01_Engine.lib contains the d3dx9 references like so (I have also tried reversing the order of these DXSDK references, with no success):

KB01_Engine properties enter image description here

enter image description here

The files in KB01_Engine include the directx 9 headers like this:

> #include <d3d9.h>
> #include <d3dx9.h>
> #include <dinput.h>

I have tried the quotation marks too, with no success

 > #include "d3d9.h"
 > #include "d3dx9.h"
 > #include "dinput.h"

KB01_Engine builds successfully. I get no errors saying that there are include files missing. But as soon as I build KB01_Game it gives me this error that is also included in the title, that I have struggled months to fix...

enter image description here

The external dependencies/header files for directx appear in KB01_Engine as expected. When I right click on d3dx9.h and click the option "Open document 'd3dx9.h' " it actually opens the correct document. There are no indications that it can't find the file. I'm strongly assuming that this build error happens because I am using KB01 engine as a static library and not as a regular application.

enter image description here

If you would like to view the code, it is available here: https://github.com/bdeboer95/KB01-Revamped

IT-Girl
  • 448
  • 5
  • 24
  • 2
    Did you try adding the directory containing those include files under "C/C++ Additional Include Directories" setting? – paisanco Jun 23 '19 at 13:02
  • Hello, thanks for answering. I have and it didnt work. Check my edit. I have included the picture for "C/C++ Additional Include Directories" . I have added $(DXSDK_DIR)Include to it. Am i missing some other directories that I need to add there? – IT-Girl Jun 23 '19 at 13:09
  • 1
    It looks like the project KB01-Game has a dependency on those DirectX includes in cutility.h and also needs the Additional Include Directories for DirectX in the setting – paisanco Jun 23 '19 at 13:20
  • Cutility.h is a file in KB01_Engine. I have tried adding the directx include directories in game but then i get: Unresolved External symbol errors. LNK2001 and LNK2019.. Here is my code, if you would like to take a look: https://github.com/bdeboer95/KB01-Revamped – IT-Girl Jun 23 '19 at 13:40
  • omg i fixed it!!! By adding what you told me to add in KB01_Game but then also adding $(DXSDK_DIR)Lib\x86; to "C++ > Additional Library directories" You are a hero! Thanks to you I went to look in there. I will finally be able to graduate xD – IT-Girl Jun 23 '19 at 14:05
  • 1
    Glad you fixed it.Usually when you get a LNK2019 you are almost home and you forgot to add Additional Library Directories to something. – paisanco Jun 23 '19 at 14:08
  • Yes that was exactly what went wrong. I never loved Link errors so much :D – IT-Girl Jun 23 '19 at 14:15

1 Answers1

1

I fixed it thanks to paisanco's comment by adding these two things:

1) Apparently it is needed to add Library directories too, which I missed in KB01_Engine properties. "Librarian > Additional Library directories"

enter image description here

2) And then I added the include directories for DirectX in KB01_Game properties "C/C++ > Additional Include Directories": enter image description here

IT-Girl
  • 448
  • 5
  • 24