Visual Studio 2017:无法打开包含文件'd3dx9.h'.exe应用程序使用的静态库中没有此类文件或目录 [英] Visual studio 2017: Cannot open include file 'd3dx9.h' no such file or directory in a static library used by .exe application

查看:125
本文介绍了Visual Studio 2017:无法打开包含文件'd3dx9.h'.exe应用程序使用的静态库中没有此类文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2017,并且需要将DirectX9.0用于学校项目.

我有3个项目的解决方案.一个是静态库(.lib),一个是应用程序(.exe),一个是单元测试项目:

KB01_Game.exe像这样导入KB01_Engine.lib:

KB01_Game属性

KB01_Engine.lib包含类似d3dx9的引用(我也尝试过反转这些DXSDK引用的顺序,但没有成功):

KB01_Engine属性

KB01_Engine中的文件包含Directx 9标头,如下所示:

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

我也尝试了引号,但没有成功

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

KB01_Engine构建成功.我没有错误地指出缺少包含文件.但是,一旦我构建KB01_Game,它就会给我带来这个错误,该错误也包含在标题中,我几个月来都在努力解决...

directx的外部依赖项/头文件按预期出现在KB01_Engine中.当我右键单击d3dx9.h并单击选项打开文档'd3dx9.h"时,它实际上会打开正确的文档.没有迹象表明它找不到文件.我强烈假设会发生此构建错误,因为我将KB01引擎用作静态库而不是常规应用程序.

如果您想查看代码,可以在这里找到:

2)然后,我在KB01_Game属性"C/C ++>其他包含目录"中添加了DirectX的包含目录:

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:

KB01_Game.exe imports KB01_Engine.lib like so:

KB01_Game properties

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

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...

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.

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

解决方案

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"

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

这篇关于Visual Studio 2017:无法打开包含文件'd3dx9.h'.exe应用程序使用的静态库中没有此类文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆