Installation and Configuration of DirectX 10 SDK in VS 2010

Firstly, we followed the detailed installation and configuration process provided by netizen yy649487394 to install the DirectX 10 SDK. This article is a supplement to it, adding a simple test case and resolving any issues that occurred during testing. The complete process is now recorded as follows.

1. Download and install the DirectX 10 SDK, configure the DirectX SDK in VS2010 to build the DirectX development environment. For details, please refer to the blog of netizen yy649487394:

2. Add the following test cases in VS 2010 (regarding vector operations):

#include <d3dx10.h>
#include <iostream>
using namespace std;
ostream& operator<<(ostream& os, D3DXVECTOR3& v)
{
os << "(" << v.x << ", " << v.y << ", " << v.z << ")";
return os;
}
int main()
{
// Using constructor, D3DXVECTOR3(FLOAT x, FLOAT y, FLOAT z);
D3DXVECTOR3 u(1.0f, 2.0f, 3.0f);
// Using constructor, D3DXVECTOR3(CONST FLOAT *);
float x[3] = {-2.0f, 1.0f, -3.0f};
D3DXVECTOR3 v(x);
// Using constructor, D3DXVECTOR3() {};
D3DXVECTOR3 a, b, c, d, e;
// Vector addition: D3DXVECTOR3 operator +
a = u + v;
// Vector subtraction: D3DXVECTOR3 operator -
b = u - v;
// Scalar multiplication: D3DXVECTOR3 operator *
c = u * 10;
// ||u||
float L = D3DXVec3Length(&u);
//d = u / ||u||
D3DXVec3Normalize(&d, &u);
// s = u dot v
float s = D3DXVec3Dot(&u, &v);
// e = u x v
D3DXVec3Cross(&e, &u, &v);
cout << "u = " << u << endl;
cout << "v = " << v << endl;
cout << "a = u + v = " << a << endl;
cout << "b = u - v = " << b << endl;
cout << "c = u * 10 = " << c << endl;
cout << "d = u / ||u|| = " << d << endl;
cout << "e = u x v = " << e << endl;
cout << "L = ||u|| = " << L << endl;
cout << "s = u.v = " << s << endl;
return 0;
}

Error encountered during debugging: error LNK2019: Unresolved external symbol_ D3DXVec3Normalize@ 8 referenced in function_ Main.

The solution is as follows:

Click on [Project] - [Property] - [Configuration Properties] - [VC++ Directories] - [Library Directories] in sequence, and add Lib X86 in the DirectX installation directory (previously, considering that the computer is 64 bit, only Lib X64 was added), for example, I added E: DX9 Lib X86.

After adding, the test example ran successfully!