Jump to content
  • Advertisement
Sign in to follow this  

problem with classes

This topic is 2115 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()
GameCamera.m_pos += (GameCamera.m_target * StepScale);

return false;

return true;

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
Sign in to follow this  

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!