I am getting LNK2005 and it pisses me of big time. What I want to do is access varables in Class A from Class B. In this case it is Camera and Input class. Input class detects 'key down' and moves the camera, now I have initialized my classes with
[source lang="cpp"]Input Keyboard;Camera GameCamera;[/source]
and my input check looks like this
[source lang="cpp"]bool Input::CheckInput(){ if(IsKeyDown(VK_NUMPAD8)) GameCamera.m_pos += (GameCamera.m_target * StepScale); if(IsKeyDown(VK_ESCAPE)) return false; return true;}[/source]
in main loop I use Keyboard.CheckInput(); to get input from the user.
I get three errors with LNK2005 first Camera class in input source and other two are Camera and Input classes in main source.
Both classes are initialized in their header files and no where else. What should I do to fix this problem.
problem with classes
Started by proanim, Dec 06 2012 07:50 PM
1 reply to this topic
Sponsor:
#2 Moderators - Reputation: 6662
Posted 06 December 2012 - 07:54 PM
You might want to read this article. You seem to be having problem number four.






