This topic is 3005 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Ok so I'm getting started with learning DirectX 10 from a book I have. As I'm going through the example everything works except the line of code dealing with the D3DXVec3Normalize function. Here's the sample code.
#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()
{

D3DXVECTOR3 u(1.0f, 2.0f, 3.0f);
float x[3] = {-2.0f, 1.0f, -3.0f};
D3DXVECTOR3 v(x);

D3DXVECTOR3 a, b, c, d, e;
a = u + v;
b = u - v;
c = u * 10;

float L = D3DXVec3Length(&u);
D3DXVec3Normalize(&d, &u);

float S = D3DXVec3Dot(&u, &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;
}

If I comment out the D3DXVec3Normalize line it links just fine. Any thoughts as to what I might have missing? Edit: Just realized that this does work in release mode but not in debug mode. Does that change anything? I put both d3dx10.lib and d3dx10d.lib in the additional dependencies. Did I miss something else?

##### Share on other sites
If you use debug you should take the following lib:
d3dx10d.lib

##### Share on other sites
Bah I'm an idiot. I put the DirectX SDK path into the additional libraries section of the project options->Linker->General section. After removing that it started working. Thanks for pointing out the d3dx10d.lib.