Question

I'm using Windows 8 / Visual Studio 2012, C++11 and Direct3D 11 for development.

I include the Direct3D libraries like this

#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")

However, the linker can't seem to find the d3dx11.lib. After adding the path where the library is located to the 'Library directories' of the project, the linker still can't find those files. Even after I copied the lib files into the project directory itself, it doesn't work.

I installed the Windows 8 SDK as well as the DirectX SDK from June 2010. Am I missing anything?

Was it helpful?

Solution

When dealing with this myself, I started here:

Where is the DirectX SDK?

then - in about the middle of that page, reading about DirectXMath:

DirectXMath

It's pretty much just including the right header files and changing "D3DX" prefixes to "XM". Not quite that simple, but that's the general idea.

Your first program will probably have inclusions/usings like this:

#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;
};

Of course, it's not considered best practice to have "using namespace", but in this one instance I found that "DirectX::" on every line of my program was making my program almost impossible (for me) to read - so I went with the "using".

Good luck!

OTHER TIPS

Probably you included bad path in properties, Instead "*DirectxSDK/Lib/x86", you included ""*DirectxSDK/Lib".

I was running into this issue as well using VS2010, but I just found the solution. You need to provider the Linker with the library file that you are having trouble with.

Project->Properties->Configuration Properties->Linker->Additional Library Directories

Then add the library file that you want into there. Worked for me, hopefully works for you too, and then you don't have to mess with DirectXMath and finding new tutorials for it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top