Jump to content
  • Advertisement
Sign in to follow this  
proanim

problem with classes

This topic is 2024 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!