Help using DirectX SDK

Started by
2 comments, last by Dissipate 9 years, 6 months ago

I decided I wanted to learn DirectX and I have been trying to get started. I got a copy of Frank Luna's DirectX 11 programming book, but I am unable to run any code.

I have had most success by using visual studio 2010 and the June 2010 DirectX SDK, but the code still wont run. I pointed VS to the SDK's include and library files, and there are no errors in the code, but when I try to build this example:


#include <windows.h> // for FLOAT definition
#include <xnamath.h>
#include <iostream>
using namespace std;

// Overload the  "<<" operators so that we can use cout to 
// output XMVECTOR and XMMATRIX objects.
ostream& operator<<(ostream& os, FXMVECTOR v)
{
	XMFLOAT4 dest;
	XMStoreFloat4(&dest, v);

	os << "(" << dest.x << ", " << dest.y << ", " << dest.z << ", " << dest.w << ")";
	return os;
}

ostream& operator<<(ostream& os, CXMMATRIX m)
{
	for(int i = 0; i < 4; ++i)
	{
		for(int j = 0; j < 4; ++j)
			os << m(i, j) << "\t";
		os << endl;
	}
	return os;
}

int main()
{
	// Check support for SSE2 (Pentium4, AMD K8, and above).
	if( !XMVerifyCPUSupport() )
	{
		cout << "xna math not supported" << endl;
		return 0;
	}

	XMMATRIX A(1.0f, 0.0f, 0.0f, 0.0f,
               0.0f, 2.0f, 0.0f, 0.0f,
			   0.0f, 0.0f, 4.0f, 0.0f,
			   1.0f, 2.0f, 3.0f, 1.0f);

	XMMATRIX B = XMMatrixIdentity();

	XMMATRIX C = A * B;

	XMMATRIX D = XMMatrixTranspose(A);

	XMVECTOR det = XMMatrixDeterminant(A);
	XMMATRIX E = XMMatrixInverse(&det, A);

	XMMATRIX F = A * E;
 
	cout << "A = "                    << endl << A << endl;
	cout << "B = "                    << endl << B << endl;
	cout << "C = A*B = "              << endl << C << endl;
	cout << "D = transpose(A) = "     << endl << D << endl;
	cout << "det = determinant(A) = " << det << endl << endl;
	cout << "E = inverse(A) = "       << endl << E << endl;
	cout << "F = A*E = "              << endl << F << endl;
 
	return 0;
}

I get this one error: LINK : fatal error LNK1104: cannot open file 'd3dll.lib'

It knows where to find that file, and I looked in the folder I pointed VS to, and the file is right there, but it can't open it.

I am running Windows 7, and I realize this is an old version of the SDK, but using the current windows SDK causes even more issues for me.

I just need a little help getting code running. I am open to switching SDKs if I can get it to work.

edit: This definitely has something to do with Luna's book. d3dll.lib is supposed to be d3d11.lib... I think. Luna's book says to add these to the linker dependencies:

d3dll.lib;
d3dxlld.lib;
D3DCompiler.lib;
Effectslld.lib;
dxerr.lib;
dxgi.lib;
dxguid.lib;
But for some reason he used 'i's instead of '1's, and there is also no 'EffectsIId.lib' or 'Effects11d.lib' in my DirectX lib files.
Advertisement
If you want to use the DirectX SDK of June 2010 instead the latter Windows SDK (Since SDK v8.x the DirectX SDK is included in the Windows SDK), read here: http://msdn.microsoft.com/en-us/library/windows/desktop/ee663275.aspx


I get this one error: LINK : fatal error LNK1104: cannot open file 'd3dll.lib'
It knows where to find that file, and I looked in the folder I pointed VS to, and the file is right there, but it can't open it.



You shouldn't need d3d11.lib for your sample, check out what you wrote in the project's proprieties. If you have troubles using the project's proprieties to link the libraries, you can add them manually to the source code with #pragma comment(lib, "xxx.lib") directive.
"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/

Ok, it seems to be able to find d3d11.lib, but now it says this:

LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

edit: Fixed it. Something to do with incompatibility with Framework .NET current and VS 2010

Solution is here:

https://ask.mozilla.org/question/26/link-fatal-error-lnk1123-failure-during-conversion-to-coff-file-invalid-or-corrupt/

But for some reason he used 'i's instead of '1's, and there is also no 'EffectsIId.lib' or 'Effects11d.lib' in my DirectX lib files.

You will need to download Effects11 source files and build it yourself with the correct configuration (win32/x64/debug/release) (also watch out for the ProjectProperties->General->toolset used) from Here: https://fx11.codeplex.com/ Note that the debug configuration of Effects11.lib doesnt have the 'd' in it! Point all your #includes to the directory or better yet copy and paste the .lib file into your project area. Its handy being able to step through the Effects11 source code while you are debugging your code, which is why it is provided.

Supplemental: If you can - you could convert Luna's book to use DX11's DirectXMath and away from the deprecated D3DX libraries http://blogs.msdn.com/b/chuckw/archive/2013/08/21/living-without-d3dx.aspx The guy's name is Chuck Walbourn check out everything from him.

This topic is closed to new replies.

Advertisement