I'm trying to create a header file holding constants and helper functions. These functions will get the range of an ID and other very simple calculation.
Well, so I wrote it as:
constants.h
...int checkIDrange(int ID) { int ID_range; if(ID >= PLAYER || ID < ENEMY) ID_range = PLAYER; return ID_range;}...
and then I tried to use it in a class implementation
PhysicsManager.cpp
void PhysicsManager::updateCollision() {...int entityA_ID_range = checkIDrange(entityA_ID);...}
and then VC++ 2008 gave me the following linker error:
1>PhysicsManager.obj : error LNK2005: "int __cdecl checkIDrange(int)" (?checkIDrange@@YAHH@Z) already defined in navinha003.obj
1>C:\Users\draco\Documents\Visual Studio 2008\Projects\navinha\Debug\navinha003.exe : fatal error LNK1169: one or more multiply defined symbols found
In bold you will find the error numbers. Obviously I'm not inserting the checkIDrange function correctly, but I can't figure what it is the correct way either..