如何在程序中包含Direct3D? [英] How to include Direct3D in a program?

查看:277
本文介绍了如何在程序中包含Direct3D?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从directxtutorial.com学习Direct3D。我在下面的代码中通过一个预处理器指令来包含它。

I am learning Direct3D from directxtutorial.com. I am including it through a preprocessor directive in the code below.

#pragma comment(lib, "d3d11.lib")
#pragma comment(lib, "d3dx11.lib")
#pragma comment(lib, "d3dx10.lib")

但是,这不是这样做的。我猜这是因为库文件不是它的检查找到它们。但是有人可以解释这里发生了什么吗?谢谢。
错误消息是:Intellisense:无法打开源文件

This is not doing it, however. I am guessing it is because the library files aren't where its checking to find them. But could someone explain what's going on here? Thanks. The error message is: "Intellisense: could not open source file"

推荐答案

请通过此链接安装Windows SDK。

You'll need to download and install the Windows SDK from this link.

接下来,您需要在Visual Studio中配置您的解决方案,以查找相应的文件。这可以分为两类:添加包含路径链接库。请注意您的Windows SDK目录。在我的系统上,它是 C:\Program Files(x86)\Microsoft SDKs\Windows \7.0A\

Next, you'll need to configure your solution in Visual Studio to look for the appropriate files. This may be broken down in to two categories: Adding the include paths and Linking the libraries. Please take note of your Windows SDK directory. On my system, it is C:\Program Files (x86)\Microsoft SDKs\Windows\7.0A\.

添加包含路径

Visual Studio预装了一部分DirectX标题 .h 文件,但完整的集合在 WindowsSDKPath \Include 中可用。

Visual Studio comes pre-packed with a subset of the DirectX header .h files, but the complete collection is available in WindowsSDKPath\Include.

将此路径添加到您项目的其他包括:

Add this path to your project's additional includes:


  • 右键单击解决方案资源管理器< c $ c>,然后从菜单中选择属性

  • 配置对话框以影响Debug和Release版本:


    • 选择第一个 选择配置属性| C / C ++ |一般。只有在您的项目中至少有一个 .c .cpp 文件时,此选项才会出现。 >
    • Additional Include Directories 框中,添加Windows SDK包含的路径,例如: C:\程序文件(x86)\Microsoft SDKs \Windows \7.0A \Include

    • 按Apply。

    • 您现在可以将直接3D头文件包含在C ++代码文件中,即 #include< d3d11.h>

    • Right click the project in the Solution Explorer, and choose Properties from the menu:
    • Configure the dialog box to affect both Debug and Release builds:
      • Select the first drop-down and choose All Configurations.

      链接库

      Direct 3D库包含在 WindowsSDKPath \Lib 文件夹。

      The Direct 3D libraries are contained in the WindowsSDKPath\Lib folder.


      • 从左侧的树中,选择配置属性|链接器输入

      • 勾选附加依赖项字段下拉箭头,选择 Edit ...

      • 在弹出对话框中,将完整路径添加到每个库,所以:


      • From the tree on the left, choose Configuration Properties | Linker | Input.
      • Tick the arrow on the drop-down of the Additional Dependencies field, choose Edit...
      • In the pop-up dialog, add the full paths to each library, with each path on its own line, like so:
      • Press Okay, then press Apply or Okay.

      现在,您的项目应配置为构建Direct 3D应用程序。

      Your project should now be configured to build Direct 3D Applications.

      这篇关于如何在程序中包含Direct3D?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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