byt*_*e77 8 c++ directx direct3d directx-11 direct3d11
我正在使用Windows 8/Visual Studio 2012,C++ 11和Direct3D 11进行开发.
我包括像这样的Direct3D库
#pragma comment(lib, "dxgi.lib")
#pragma comment(lib, "d3d11.lib")
#pragma comment(lib, "d3dx11.lib") // <-- error LNK1104: cannot open file 'd3dx11.lib'
#pragma comment(lib, "d3dx10.lib")
Run Code Online (Sandbox Code Playgroud)
但是,链接器似乎找不到d3dx11.lib.将库所在的路径添加到项目的"库目录"后,链接器仍无法找到这些文件.即使我将lib文件复制到项目目录本身后,它也无法正常工作.
我从2010年6月起安装了Windows 8 SDK和DirectX SDK.我错过了什么吗?
当我自己处理这个问题时,我从这里开始:
然后 - 在该页面的中间,阅读有关DirectXMath:
它几乎只包括正确的头文件并将"D3DX"前缀更改为"XM".不是那么简单,但这是一般的想法.
你的第一个程序可能会包含这样的内容/使用:
#include <d3d11.h>
#include “DirectXMath.h”
#include “DirectXPackedVector.h”
using namespace DirectX;
using namespace DirectX::PackedVector;
struct mystruct
{
DirectX::XMFLOAT3 position;
DirectX::PackedVector::HALF packedValue;
};
Run Code Online (Sandbox Code Playgroud)
当然,使用"使用命名空间"并不是最佳实践,但在这一个实例中,我发现我的程序的每一行上的"DirectX ::"使我的程序几乎不可能(对我而言)阅读 - 所以我去了与"使用".
祝好运!