   Linker Error
  Hey, I am new to programming and I am having a problem with a linker error.bool Character::Move(float DeltaTime,MovementDirection MoveDir, float PlayerSpeed){m_PlayerSpeed=PlayerSpeed;switch(MoveDir){case DIRECTION_NORTH:{  m_CharacterRect.top = m_CharacterRect.top + m_PlayerSpeed*DeltaTime;.......etcIm getting a linker error, and I know its because of  m_PlayerSpeed*DeltaTime, but I dont know why. I define m_PlayerSpeed from the parameter list, and DeltaTime is also right there, so I have no idea what to do:( Thanks for any help.   
  Could you please post the part of the linker message that notifies the error?   ;  Oooops sorry, thought I forgot something^_^Character.obj : error LNK2019: unresolved external symbol __ftol2_sse referenced in function "public: bool __thiscall Character::Move(float,enum Character::MovementDirection,float)" (?Move@Character@@QAE_NMW4MovementDirection@1@M@Z)C:\Documents and Settings\Mathius\My Documents\Visual Studio 2005\Projects\FluxEngine\Release\FluxEngine.exe : fatal error LNK1120: 1 unresolved externals   ;  It seems that you are using SSE somewhere, but don't link with the SSE libaries. Now, from your code snippet I don't see any SSE stuff. But, after Googling a bit, I found that M$ has distributed a bug with VS2005/VisualC++ 2005 in the float/int conversion (some people speak from double/long conversion only; I don't know).Is m_CharacterRect.top actually an integer? If so, you may be trapped by this bug.Quote:Micheal WheelerThis is a known bug with VS2005 beta -- and apparently still exists with the released version.  Add /QIfist to the C/C++ Command Line Additional Options pane.  It generates a deprecation warning but it works.Another option which usually works is to cast the float to an __int64 before converting it to a long:float foo = 3.14; // or any float valuelong bar = (long)(__int64) foo;For int (instead of long) you may try something likem_CharacterRect.top += (int)(__int32)m_PlayerSpeed*DeltaTime;I don't use M$, so I can't check for this...;  RECT is a long value I beleive.   ;Quote:Original post by Mathius20RECT is a long value I beleive.Okay. Micheal Wheeler's post (the one I've cited) deals with longs. So you may trym_CharacterRect.top += (long)(__int64)m_PlayerSpeed*DeltaTime;;  When I do that it pulls up another linker error:(;Quote:Original post by Mathius20When I do that it pulls up another linker error:(So you have the choice between errors A and B ;)Seriously, being still on the trip that you've been trapped by that bug, try to use other conversions.DeltaTime and PlayerSpeed are both floats. I assume also m_PlayerSpeed to be a float. The symbol __ftol2_sse seems good for "float to long" conversion.If you're still interested in my "don't know, but perhaps" ...What happens if you try to convert the float into a double first? AFAIK SSE doesn't deal with doubles. So, what happens with this line?m_CharacterRect.top += ((double)PlayerSpeed)*DeltaTime;   ;  Same thing:( Whaaaa. I suck at linker errors. It's hard to believe that its really a bug though.   ;  Well, due to this weiredness I've re-programmed your snippet like so:class Character {public:struct Rect {long top,bottom,left,right;};enum MovementDirection {DIRECTION_NORTH,DIRECTION_SOUTH};bool Move(float DeltaTime,MovementDirection MoveDir,float PlayerSpeed);Rect m_CharacterRect;float m_PlayerSpeed;};boolCharacter::Move(float DeltaTime,MovementDirection MoveDir,float PlayerSpeed) {m_PlayerSpeed = PlayerSpeed;switch(MoveDir) {case DIRECTION_NORTH: {m_CharacterRect.top += (long)(m_PlayerSpeed*DeltaTime);} break;case DIRECTION_SOUTH: {m_CharacterRect.top -= (long)(m_PlayerSpeed*DeltaTime);} break;}return true;}The explicit conversion of the float to long is done due to a warning:In member function `bool Character::Move(float, Character::MovementDirection, float)': warning: converting to `long int' from ` float'However, the above snippet is compiled and linked well using gcc under linux, and I don't see a reason why other compilers/linkers should have a problem with it from a source code related point of view.   