Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


problem with classes


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 proanim   Members   -  Reputation: 446

Like
0Likes
Like

Posted 06 December 2012 - 07:50 PM

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.

Sponsor:

#2 SiCrane   Moderators   -  Reputation: 9676

Like
0Likes
Like

Posted 06 December 2012 - 07:54 PM

You might want to read this article. You seem to be having problem number four.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS