Bonsoir la zone,
J’essaie de faire un code Cplouchplouch ultra propre et ultra relou pendant la compilation, histoire qu’il m’emmerde dès que je fais une erreur .
J’ai déja un code de base, et j’ai “tuné” qqes opérateurs sur une classe ‘Color’.
Color.h
[code]class Color
{
protected:
double m_R,m_G,m_B;
double m_A; // composante alpha
public:
Color();
Color(double R,double G,double B,double A = 1);
double GreyLevel() const;
Color(const Color &color);
virtual ~Color();
Color &operator = (const Color& color);
inline const Color operator + (const Color &color) const; //voila les 4 operateurs
inline const Color operator - (const Color &color) const; // que j'ai bidouillés
inline const Color operator * (double a) const; // en rajoutant inline const ... (const) const
inline const Color operator * (const Color & color) const;
inline const Color operator / (double a) const;
COLORREF REF(); // code Color de windows
};[/code]
implémentés comme suit:
Color.cpp
[code]inline const Color Color::operator+(const Color &rhs) const
{
return Color(m_R + rhs.m_R,
m_G + rhs.m_G,
m_B + rhs.m_B,
m_A + rhs.m_A);
}
inline const Color Color::operator*(double rhs) const
{
return Color(m_Rrhs,
m_Grhs,
m_Brhs,
m_Arhs);
}[/code]
et je les utilise dans une autre classe comme ceci:
Texture.cpp
[code]const Color Texture::Interpol(double x,double y) const
{
int xx,yy;
double cx,cy;
double ccx,ccy;
while ( x < 0 ) x += m_wWidth;
while ( y < 0 ) y += m_wHeight;
while ( x >= m_wWidth ) x -= m_wWidth;
while ( y >= m_wHeight ) y -= m_wHeight;
xx = int(x);
yy = int(y);
cx=x-xx;
cy=y-yy;
ccx=cx*cx;
ccy=cy*cy;
return GetColor(xx ,yy ) * (1-ccx)*(1-ccy)
+ GetColor(xx+1,yy ) * ccx*(1-ccy)
+ GetColor(xx ,yy+1) * (1-ccx)*ccy
+ GetColor(xx+1,yy+1) * ccx*ccy;
}[/code]
Et voila que le compilateur me sort ces deux erreurs que j’ai djà un peu de mal a lire, et je ne trouve pas ce qu’il a à me reprocher:
[ul]
[li]Error 1 error LNK2019: unresolved external symbol "public: class Color const __thiscall Color::operator+(class Color const &)const " (??HColor@@QBE?BV0@ABV0@@Z) referenced in function "protected: class Color const __thiscall Texture::Interpol(double,double)const " (?Interpol@Texture@@IBE?BVColor@@NN@Z) texture.obj Projet IMA[/li][li]Error 2 error LNK2019: unresolved external symbol "public: class Color const __thiscall Color::operator*(double)const " (??DColor@@QBE?BV0@N@Z) referenced in function "protected: class Color const __thiscall Texture::Interpol(double,double)const " (?Interpol@Texture@@IBE?BVColor@@NN@Z) texture.obj Projet IMA[/li][/ul]
Pourquoi il ne prend pas mes opérateurs?
EDIT: ajout extrait Color.cpp