inline d'une fonction tout simple LNK2001
Bonjour,
J'ai une petite fonction qui est utilisée à quelques endroits, j'aurais bien aimé l'inliner, mais le compilateur ne veux pas.
voici le code, propotypage :
Code:
inline SDL_Rect Rect(const Sint16 x,const Sint16 y,const Uint16 w,const Uint16 h);
et voici la definition :
Code:
1 2 3 4 5 6 7 8 9
| inline SDL_Rect Rect( const Sint16 x,const Sint16 y,const Uint16 w,const Uint16 h )
{
SDL_Rect r;
r.x=x;
r.y=y;
r.w=w;
r.h=h;
return r;
} |
et pour info, un SDL_Rect est défini ainsi (n'est pas de moi, donc ca je ne peux pas y toucher)
Code:
1 2 3 4
| typedef struct SDL_Rect {
Sint16 x, y;
Uint16 w, h;
} SDL_Rect; |
seulement le compilateur ne veux pas en entendre parler :
screen.obj : error LNK2001: unresolved external symbol "struct SDL_Rect __cdecl Rect(__int16,__int16,unsigned __int16,unsigned __int16)" (?Rect@@YA?AUSDL_Rect@@_F0_G1@Z)
j'ai essayé avec ou sans le mot "inline" devant la definition, ca ne change rien.
une idée ?
merci.