Hello ppl,
As in my last post I'm setting up directx stuff etc in a static library, and was converting stuff over from an vs2003 project to my vs2005 project.
when compiling it gave me an erro saying: LNK4221....
saying that cVector3.obj doesn't have public stuff and will there for not be accessible...at least what I make of it
cVector3.h file
#ifndef VECTOR3_H
#define VECTOR3_H
#include "math.h"
#include "d3dx9math.h"
class cVector3 : public D3DXVECTOR3
{
public:
//Creators
//--------
cVector3(void){};
cVector3 (const cVector3& vec) : D3DXVECTOR3(vec.x, vec.y, vec.z){};
cVector3 (float _x,float _y,float _z) : D3DXVECTOR3(_x,_y,_z){};
virtual ~cVector3(void){};
//Operators
//---------
const cVector3& operator *= (const cVector3& vec);
const cVector3& operator /= (const cVector3& vec);
const cVector3& operator *= (float v);
const cVector3& operator /= (float v);
//Mutators
//--------
void set (float _x,float _y ,float _z);
void clear (void);
bool isClear()const;
//Calculations/Operations
//-----------------------
//Length & distance calculations
void Normalize();
float Length()const;
float LenghtSquared() const;
//dot and cross product
float dotProduct(const cVector3& _vec)const;
void crossProduct(const cVector3& _vec);
void crossProduct (const cVector3& _vecA, const cVector3& _vecB);
};
#endif
#include "Vector3.h"
const cVector3& cVector3::operator *= (const cVector3& vec)
{
x *= vec.x;
y *= vec.y;
z *= vec.z;
return(*this);
}
const cVector3& cVector3::operator *= (float v)
{
x *= v;
y *= v;
z *= v;
return(*this);
}
// divide
const cVector3& cVector3::operator /= (const cVector3& vec)
{
// debug_assert(vec.x != 0.0f, "divide by zero error");
// debug_assert(vec.y != 0.0f, "divide by zero error");
// debug_assert(vec.z != 0.0f, "divide by zero error");
x /= vec.x;
y /= vec.y;
z /= vec.z;
return(*this);
}
const cVector3& cVector3::operator /= (float v)
{
// debug_assert(v != 0.0f, "divide by zero error");
x /= v;
y /= v;
z /= v;
return(*this);
}
cVector3 operator * (float scalar, const cVector3 &a)
{
return(cVector3((a.x * scalar), (a.y * scalar), (a.z * scalar)));
}
cVector3 operator * (const cVector3 &a, float scalar)
{
return(cVector3((a.x * scalar), (a.y * scalar), (a.z * scalar)));
}
cVector3 operator - (const cVector3 &a, const cVector3 &b)
{
return(cVector3((a.x - b.x), (a.y - b.y), (a.z - b.z)));
}
void cVector3::set(float _x, float _y, float _z)
{
x = _x;
y = _y;
z = _z;
}
void cVector3::clear(void)
{
x = 0.0f;
y = 0.0f;
z = 0.0f;
}
bool cVector3::isClear()const
{
return (x == 0.0f)
&& (y == 0.0f)
&& (z == 0.0f);
}
void cVector3::Normalize()
{
D3DXVec3Normalize(this,this);
}
float cVector3::Length()const
{
return D3DXVec3Length(this);
}
float cVector3::LenghtSquared() const
{
return D3DXVec3LengthSq(this);
}
float cVector3::dotProduct(const cVector3 &_vec) const
{
return D3DXVec3Dot(this, &_vec);
}
void cVector3::crossProduct(const cVector3 &_vec)
{
D3DXVec3Cross(this, this, &_vec);
}
void cVector3::crossProduct(const cVector3 &_vecA, const cVector3 &_vecB)
{
D3DXVec3Cross(this, &_vecA, &_vecB);
}
Same thing with cVector2 (.h/.cpp) which have the same build up internally...
I know for sure I didn't have this error before in my vc2003 project.
Because, I could use internally in the lib the cvector2 and 3 -objects.
Best regards and best wishes 2007 already people[attention][attention][attention]